EC 333 Microprocessor and Interfacing Techniques (3+1)

Size: px
Start display at page:

Download "EC 333 Microprocessor and Interfacing Techniques (3+1)"

Transcription

1 EC 333 Microprocessor and Interfacing Techniques (3+1) Lecture /88 Microprocessor Programming (Arithmetic Instructions) Dr Hashim Ali Fall 2018 Department of Computer Science and Engineering HITEC University Taxila

2 Assemble, Link and Run a Program Steps in creating an executable Assembly Language Program 2

3 Assembly Instructions 3

4 Assembly Language Basics Character or String Constants - ABC - X - This isn t a test Numeric Literals Ah b - 2BH - 47d 4

5 Statements longarraydefinition dw 1000h,1020h,1030h \,1040h, 1050h, 1060h, 1070h Lines may break with \ character Identifier name limit of max 247 characters Case insensitive Variable - Count1 db 50 ; a variable (memory allocation) Label: - If a name appears in the code area of the program it is a label. LABEL1: mov ax,0 mov bx,1 LABEL2: jmp Label1 ;jump to label1 5

6 Assembler Directives Model: Selects the size of the memory model. -.MODEL SMALL : Reserves 64KB memory for Code Segment (CS) and 64KB for Data Segment (DS). -.MODEL MEDIUM : CS can exceed 64KB but DS must fit in 64KB of memory. -.MODEL COMPACT : CS is of fixed 64KB size but DS can vary. -.MODEL LARGE : Both CS & DS can exceed 64KB but only one of them. -.MODEL HUGE : Both can exceed its 64KB memory size. -.MODEL TINY : Used with compact (com) files in which CS & DS must fit into 64KB. 6

7 Assembly Code Template.MODEL SMALL.STACK ; beginning of the stack segment.data ; beginning of the data segment.code ; beginning of the code segment Ex:.DATA DATAW DW 213FH DATAB DB 52H SUM DB? ;nothing stored but storage is assigned Ex:.CODE ProgramName PROC ProgramName ENDP END ProgramName ; name of the program ; program statements 7

8 Data Types and Data Definition ORG (Origin) Used to set the beginning of offset address. DB (Define Byte) Reserve or allocate memory in byte size. Example: Data1 DB 25H Data2 DB B DQ (Define Quad-Word) Reserve or allocate 8 bytes of memory. DUP (Duplicate) Used to duplicate a given data Example: Data1 DB 6 DUP(?) Data2 DB 2 DUP(12H) DW or DWORD (Define Word) Reserve or allocate 2 bytes of memory. DD (Define Double-Word) Reserve or allocate 4 bytes of memory. 8

9 Data Types and Data Definition Data1 DB 25 Data2 DB b Data3 DB 12h ORG 0010h ; indicates distance from initial location Data4 DB 2591 ORG 0018h Data5 DB? 9

10 DB DW DD.data msg1 DB msg2 DW 6667H data1 DB 1,2,3 DB 45h DB a DB b data2 DW 12,13 DW 2345H DD 300H ; How it looks like in memory F0 0C 00 0D

11 More Examples DB 6 DUP(FFh); fill 6 bytes with ffh DW 954 DW 253Fh ; allocates two bytes DD 5C2A57F2h ; allocates eight bytes DQ 12h ; allocates four bytes COUNTER1 DB COUNT COUNTER2 DB COUNT 11

12 More Assembly OFFSET - The offset operator returns the distance of a label or variable from the beginning of its segment. The destination must be 16 bits. mov bx, offset count SEG - The segment operator returns the segment part of a label or variable s address. push ds mov ax, seg array mov ds, ax mov bx, offset array pop ds DUP operator only appears after a storage allocation directive. db 20 dup(?) EQU directive assigns a symbolic name to a string or constant. Maxint equ 0ffffh COUNT EQU 2 12

13 Simple Assembly Program Addition of two numbers.model small.stack 64.data data1 DB 52H data2 DB 29H sum DB?.code main proc mov mov ds, ax mov al, data1 mov bl, data2 add al, bl mov sum, al mov ax, 4C00H int 21H main endp end main 13

14 Arithmetic Instructions Topic covers the following instructions:- - Addition (ADD, INC, ADC) - Subtraction (SUB, DEC, SBB, CMP) - Multiplication (MUL, IMUL) - Division (DIV, IDIV) - BCD Arithmetic (DAA, DAS) 14

15 Addition Instructions Addition appears in many forms in the microprocessor. - Register addition - Immediate addition - Memory to register addition - Increment addition - Addition-with-carry Note: - The only types of addition not allowed are memory-tomemory and segment register. Example: ADD CS, DS ; Not allowed ADD [AX], [BX] ; Not allowed 15

16 Register Addition Register addition instructions are used to add the contents of registers. - Example: ADD AL, BL ; AL = AL+BL ADD CX, DI ; CX = CX+DI 16

17 Immediate Addition Immediate addition is employed whenever constants or known data are added. - Example: ADD CL, 44H ; CL=CL+44H ADD BX, 245FH ; BX=BX+245FH 17

18 Memory to Register Addition Memory data can be added with register content. - Example: ADD CL, [BP] The byte content of the stack segment memory location addressed by BP add to CL with the sum stored in CL. ADD [BX], AL AL adds to the byte contents of the data segment memory location addressed by BX with the sum stored in the same memory location. Note: - Data Segment is used by default when BX, DI or SI is used to address memory. - If the BP register addresses memory, the stack segment is used by default. 18

19 Increment Addition Increment addition (INC) adds 1 to any register or memory location except a segment register. With indirect memory increments, the size of the data must be described by using the BYTE PTR, WORD PTR or, DWORD PTR assembler directives. Increment instructions affect the flag bits, as do most of the arithmetic and logic operations. The difference is that increment instructions do not affect the carry flag bit. - Example: INC BL ; BL = BL+1 INC SP ; SP = SP+1 INC BYTE PTR[BX] ; Add 1 to the byte contents of the data segment memory location addressed by BX. 19

20 Addition with Carry (ADC) An addition with carry (ADC) instruction adds the bit in the carry flag (C) to the operand data. - Example: ADC AL, AH ; AL=AL+AH+carry ADC DH, [BX] ; The byte content of the data segment memory location addressed by BP add to DH with the sum stored in DH. 20

21 Example Addition with Carry (ADC) - ADD AX, CX - ADC BX, DX 21

22 Changes of FLAG Bits after Addition Changes bits by any Add instruction: Sign, Zero, Carry, Auxiliary carry, parity and overflow flag. Z = 0 (Result not zero) C = 0 (No carry) A = 0 (No half carry) S = 0 (Positive result) P = 0 (Odd parity) O = 0 (No overflow) Z = 1 (Result zero) C = 1 (Carry exists) A = 1 (Half carry exists) S = 1 (Negative result) P = 1 (Even parity) O = 1 (Overflow occur) 22

23 Problem (Assignment) a) Develop a short sequence of instructions that adds two thirty two bit numbers (FE432211H and D1234EF1H) with the sum appearing in BX-AX b) What is wrong with the following instructions: - ADD AL, AX - ADC CS, DS - INC [BX] - ADD [AX], [BX] - INC SS c) Suppose, present content of flag register is 058FH. Find the content of AX and Flag register after executing the following instructions: - MOV AX, 1001H - MOV DX, 20FFH - ADD AX, DX d) Develop a short sequence of instructions that adds AL, BL, CL, DL and AH. Save the sum in the DH register. 23

24 Subtraction Instructions Many forms of subtraction appear in the instruction set. - Register Subtraction - Immediate Subtraction - Decrement Subtraction - Subtraction with Borrow - Comparison Note: - The only types of subtraction not allowed are memory-tomemory and segment register subtractions. - Example: SUB CS, DS ; Not allowed SUB [AX], [BX] ; Not allowed 24

25 Register Subtraction Register subtraction instructions are used to subtract the contents of registers. - Example: SUB AL, BL ; AL = AL-BL SUB CX, DI ; CX = CX-DI 25

26 Immediate Subtraction Immediate subtraction is employed whenever constants or known data are subtracted. - Example: SUB CL, 44H ; CL = CL-44H SUB BX, 245FH ; BX = BX-245FH 26

27 Memory to Register Subtraction Memory data can be subtracted from register content. - Example: SUB [DI], CH Subtract CH from the byte content of data segment memory addressed by DI and stores the result in same location. SUB CH, [BP] Subtract the byte contents of the stack segment memory location addressed by BP from CH and the result stored in CH. Note: - Data Segment is used by default when BX, DI or SI is used to address memory. - If the BP register addresses memory, the stack segment is used by default. 27

28 Decrement Subtraction Decrement subtraction (DEC) subtract 1 from a register or memory location except a segment register. With indirect memory increments, the size of the data must be described by using the BYTE PTR, WORD PTR or, DWORD PTR assembler directives. - Example: DEC BL ; BL = BL-1 DEC SP ; SP = SP-1 DEC BYTE PTR[BX] ; Subtracts 1 from the byte contents of the data segment memory location addressed by BX. DEC WORD PTR[BP] ; Subtracts 1 from the word content of the stack segment memory location addressed by BP. 28

29 Subtraction with Borrow (SBB) A subtraction with borrow (SBB) instruction functions as a regular subtraction, except that the carry flag (C), which hold the borrow, also subtracts from the difference. The most common use for this instruction is for subtractions that are wider than 16-bits. - Example: SBB AL, AH ; AL = AL-AH-Carry SBB DH, [BX] ; The byte content of the data segment memory location addressed by BP subtracted from DH and result stored in DH. Note: - Immediate subtraction from a memory location requires BYTE PTR,WORD PTR directives. - Example: SBB BYTE PTR[DI], 3 ; Both 3 and carry subtract from data segment memory location addressed by DI. 29

30 Comparison The comparison instruction (CMP) is a subtraction that changes only the flag bits, the destination operand never changes. A comparison is useful for checking the entire contents of a register or a memory location against another value. A CMP is normally followed by a conditional jump instruction, which test condition of the flag bits. - Example: CMP CL, BL ; CL-BL - The result of comparison depends on CF, ZF and SF. CF ZF SF Result Result of subtraction is zero (the values are equal) st value is greater than 2nd value (No borrow) nd value is greater than 1st value (Needs borrow) 30

31 Conditional jump instructions that often followed by CMP instruction are: Nmeonic Condition Tested Operation JA ZF = 0 & CF = 0 Jump if above For JAE CF = 0 Jump above or equal UNSIGEND numbers JB CF = 1 Jump if below JBE ZF = 1 & CF = 1 Jump below or equal JC CF = 1 Jump if carry JE or JZ ZF = 1 Jump if equal, Jump if zero For SIGNED numbers Example: JG ZF = 0 & SF = 0 Jump if greater then JGE SF = 0 Jump greater then or equal JL SF!= 0 Jump if less then JLE ZF = 1 or SF!= 0 Jump less then or equal JNC CF = 0 Jump if no carry JNE or JNZ ZF = 0 Jump if not equal to, Jump if not zero - CMP AL, 10H ; Compare AL against 10H - JAE EEE ; If AL is 10H or above program jump to EEE 31

32 Multiplication Instructions In 8086 multiplication is performed on bytes (8-bit) and words (16-bit) and can be signed integer (IMUL) or unsigned integer (MUL). If two 8-bit numbers are multiplied, they generate 16-bit product; if two 16-bit numbers are multiplied they generate 32-bit product. Some flag bits, O (overflow) and C (carry) changes when multiply instruction executes and produce predictable outcomes. The other flag also change, but their results are unpredictable and therefore are unused. 32

33 8-bit multiplication (signed and unsigned) Multiplicand is always in AL register Multiplier can be any 8-bit register or any memory location. Product is placed in AX register. (For signed multiplication, the product is in binary form, if positive, and in 2 s complement form, if negative. For unsigned multiplication result is always in binary form). Immediate multiplication is not allowed. Unsigned multiplication uses MUL instruction and signed multiplication uses IMUL instruction. - Example: MUL CL ; AL is multiplied by CL, the unsigned product is in AX IMUL DH ; AL is multiplied by DH, the signed product is in AX IMUL BYTE PTR[BX] ; AL is multiplied by byte contents of the data segment memory location addressed by BX, the signed product is in AX. 33

34 16-bit multiplication (signed and unsigned) Multiplicand stay in AX. Multiplier can stay any 16-bit register or memory location. 32-bit product appear in DX-AX. The DX register always contains the most significant 16 bits and AX contains the least significant bits of the product. - Example: MUL CX ; AX is multiplied by CX, the unsigned product is in DX-AX. IMUL DI ; AX is multiplied by DI, the signed product is in DX- AX. MUL WORD PTR[SI]; AX is multiplied by the word content of data segment memory location addressed by SI, the unsigned product is in DX-AX. 34

35 Point to Remember!! Multiplication Operand 1 Operand 2 Result Byte x Byte AL Register or Memory AX Word x Word AX Register or Memory DX AX Byte x Word AL=Byte, AH=0 Register or Memory DX AX 35

36 Problem (Assignment) Write a short sequence of instructions that multiply 4 with 10 and the result is stored in DX. 36

37 Division Instructions Division occurs on 8-bit or 16-bit numbers in the microprocessors, and on 32-bit numbers in the Pentium 4 microprocessor. Unsigned division use DIV instruction and signed division use IDIV instruction. The dividend is always a double-width dividend that is divided by the operand. This means that an 8-bit division divides a 16-bit number by an 8-bit number; a 16-bit division divides a 32-bit number by a 16-bit number. There is no immediate division instruction available to any microprocessor. None of the flag bits change predictably for a division. 37

38 8-bit Division Dividend (which is divided by a value) always stored in AX. The dividing content is stored in any 8-bit register or memory location. The quotient moves into AL division. Reminder stored in AH register. - Example: DIV CL ; AX is divided by CL, the unsigned quotient is in AL and the unsigned reminder is in AH. IDIV BL ; AX is divided by BL, the signed quotient is in AL and the signed reminder is in AH. DIV BYTE PTR[BP] ; AX is divided by the byte content of the stack segment memory location addressed by BP, the unsigned quotient is in AL and unsigned remainder is in AH. 38

39 16-bit division Dividend (which is divided by a value) always stored in DX-AX. The dividing content is stored in any 16-bit register or memory location. The quotient appears in AX. Reminder appears in DX register. - Example: - DIV CX ; DX-AX is divided by CX, the unsigned quotient is in AX and the unsigned remainder is in DX. - IDIV SI ; DX-AX is divided by SI, the signed quotient is in AX and the signed remainder is in DX. 39

40 Point to Remember!! Divission Dividend Divisor Quotient Reminder Byte / Byte Word / Word Word / Byte Double-Word / Word Example: - DATA1 DB 45H - DATA2 DB 10H - QOU DB? - REM DB? - MOV AL, DATA1 AL=Byte, AH=0 AX=Word, DX=0 AX=Word DXAX=Double-Word Register or Memory Register or Memory Register or Memory Register or Memory - SUB AH, AH - DIV DATA2 - MOV QOU, AL - MOV REM, AH AL AX AL AX AH DX AH DX 40

41 CBW (Convert signed byte to signed word) This instruction copies the sign of a byte in AL to all the bits in AH. AH is then said to be sign extension of AL. The CBW operation must be done before a signed byte in AL can be divided by another signed byte with the IDIV instruction. CBW effects no flag. - Example: Suppose we want to divide -38 by +3. AL = = -26H = -38 decimal CH = = +3H = +3 decimal - MOV AL, -26H - MOV CH, 03H - CBW ; Extended sign of AL through AH. AX= IDIV CH; Divide AX by CH AL= = -OCH = -12 decimal AH = = -2 decimal 41

42 CWD (Convert signed Word to signed Double word) CWD copies the sign of a word in AX to all the bits of the DX register. In other words, it extends the sign of AX into all of DX. The CWD operation must be done before a signed word in AX can be divided by another signed word with the IDIV instruction. CWD affects no flag. - Example: Divide decimal by +250 decimal. AX= = decimal CX = = +250 decimal DX = CWD DX= AX= IDIV CX 42

43 Problem (Assignment) a) Write a short sequence of instruction to divide 800 by 100. The result should be stored in CL register. b) Write a short sequence of instructions that divide the number in BL by the number in CL and then multiplies the result by 2. The final answer must be a 16-bit number stored in the DX register. c) [{130-(300/50)+6}*9] 43

44 BCD Arithmetic Instructions The addition or subtraction of two BCD numbers result a binary number. To adjust this number into BCD the following instructions are used:- - DAA (Decimal adjust AL after BCD addition) - DAS (Decimal adjust AL after BCD subtraction) 44

45 DAA (Decimal adjust AL after BCD addition) This instruction is used to make sure the result of adding two packed BCD numbers is adjusted to be a legal BCD number. The result must be in AL for DAA to work correctly. If the lower nibble in AL after addition is greater than 9 or AF was set by the addition, then the DAA instruction will add 6 to the lower nibble in AL. If the result in the upper nibble of AL is now greater than 9 or if the carry flag was set by the addition or correction, then DAA instruction will add 60H to AL. 45

46 Example: a) Let, AL = = 59 BCD, and BL = = 35 BCD - ADD AL,BL ; AL = = 8EH - DAA ; Add 0110 because 1110 > 9 ; AL = = 94 BCD b) Let, AL= (88 BCD), and BL= (49 BCD) - ADD AL, BL ; AL = , AF=1 - DAA ; Add 0110 because AF=1 ; AL= (D7H) ; 1101>9 so add ; AL= (37 BCD), CF=1 46

47 DAS (Decimal adjust AL after BCD subtraction) This instruction is used after subtracting two packed BCD numbers to make sure the result is correct packed BCD. The result of subtraction must be in AL for DAS to work correctly. If the lower nibble in AL after subtraction is greater than 9 or the AF was set by the subtraction then DAS instruction will subtract 6 from the lower nibble of AL. If the result in the upper nibble is now greater than 9 or if the carry flag was set, the DAS instruction will subtract 60 from AL. 47

48 Example: a) Let, AL = (86 BCD), and BH= (57 BCD) - SUB AL,BH ; AL = (2FH), CF=0 - DAS ; Lower nibble of results is 1111>9, ;so DAS automatically subtracts ; AL = (29 BCD) 48

49 Problem a) Write an instruction set to implement a decimal up counter using DAA instruction. b) Write an instruction set to implement a decimal down counter using DAS instruction. 49

50 Solution of problem Decimal up counter:- - MOV COUNT, 63H ; initialise count in memory location as 1. - MOV AL, COUNT ; Bring COUNT into AL to work on. - ADD AL, 01H ; increment the value by 1. - DAA ; Decimal adjust the result. - MOV COUNT, AL ; Put decimal result back in memory. Decimal down counter:- - MOV COUNT, 63H ; initialise count in memory location as 99 decimal (63H). - MOV AL, COUNT ; Bring COUNT into AL to work on. - SUB AL, 01H ; Decrement the value by 1. - DAS ; Decimal adjust the result. - MOV COUNT, AL ; Put new count back in memory. 50

Arithmetic Instructions

Arithmetic 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 information

CS-202 Microprocessor and Assembly Language

CS-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 information

Kingdom of Saudi Arabia Ministry of Higher Education. Taif University. Faculty of Computers & Information Systems

Kingdom of Saudi Arabia Ministry of Higher Education. Taif University. Faculty of Computers & Information Systems Kingdom of Saudi Arabia Ministry of Higher Education Taif University Faculty of Computers & Information Systems المملكة العربية السعودية وزارة التعليم العالي جامعة الطاي ف آلية الحاسبات ونظم المعلومات

More information

Intel 8086: Instruction Set

Intel 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 information

Ex: Write a piece of code that transfers a block of 256 bytes stored at locations starting at 34000H to locations starting at 36000H. Ans.

Ex: 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 information

Week /8086 Microprocessor Programming I

Week /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 information

Lecture 9. INC and DEC. INC/DEC Examples ADD. Arithmetic Operations Overflow Multiply and Divide

Lecture 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 information

Signed number Arithmetic. Negative number is represented as

Signed 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 information

SPRING TERM BM 310E MICROPROCESSORS LABORATORY PRELIMINARY STUDY

SPRING 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 information

We will first study the basic instructions for doing multiplications and divisions

We 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 information

Code segment Stack segment

Code segment Stack segment Registers Most of the registers contain data/instruction offsets within 64 KB memory segment. There are four different 64 KB segments for instructions, stack, data and extra data. To specify where in 1

More information

8086 INSTRUCTION SET

8086 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 information

EXPERIMENT WRITE UP. LEARNING OBJECTIVES: 1. Get hands on experience with Assembly Language Programming 2. Write and debug programs in TASM/MASM

EXPERIMENT 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 information

INSTRUCTOR: ABDULMUTTALIB A. H. ALDOURI

INSTRUCTOR: 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 information

Summer 2003 Lecture 4 06/14/03

Summer 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 information

EC-333 Microprocessor and Interfacing Techniques

EC-333 Microprocessor and Interfacing Techniques EC-333 Microprocessor and Interfacing Techniques Lecture 3 The Microprocessor and its Architecture Dr Hashim Ali Fall - 2018 Department of Computer Science and Engineering HITEC University Taxila Slides

More information

EC-333 Microprocessor and Interfacing Techniques

EC-333 Microprocessor and Interfacing Techniques EC-333 Microprocessor and Interfacing Techniques Lecture 4 Addressing Modes Dr Hashim Ali Spring - 2018 Department of Computer Science and Engineering HITEC University Taxila Slides taken from Computer

More information

Lecture (08) x86 programming 7

Lecture (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 information

Lecture (07) x86 programming 6

Lecture (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 information

Mnem. 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

Mnem. 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 information

IBM PC Hardware CPU 8088, Pentium... ALU (Arithmetic and Logic Unit) Registers. CU (Control Unit) IP.

IBM PC Hardware CPU 8088, Pentium... ALU (Arithmetic and Logic Unit) Registers. CU (Control Unit) IP. IBM PC Hardware CPU 8088, 8086 80286 80386 80486 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

More information

SPRING TERM BM 310E MICROPROCESSORS LABORATORY PRELIMINARY STUDY

SPRING 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 information

EEM336 Microprocessors I. Arithmetic and Logic Instructions

EEM336 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 information

Week /8086 Microprocessor Programming

Week /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 information

8086 INTERNAL ARCHITECTURE

8086 INTERNAL ARCHITECTURE 8086 INTERNAL ARCHITECTURE Segment 2 Intel 8086 Microprocessor The 8086 CPU is divided into two independent functional parts: a) The Bus interface unit (BIU) b) Execution Unit (EU) Dividing the work between

More information

Arithmetic and Logic Instructions And Programs

Arithmetic 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 information

8088/8086 Programming Integer Instructions and Computations

8088/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 information

9/25/ Software & Hardware Architecture

9/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 information

Marking Scheme. Examination Paper Department of CE. Module: Microprocessors (630313)

Marking 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 information

8086 Programming. Multiplication Instructions. Multiplication can be performed on signed and unsigned numbers.

8086 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 information

BAHAR DÖNEMİ MİKROİŞLEMCİLER LAB4 FÖYÜ

BAHAR 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 information

Marking Scheme. Examination Paper. Module: Microprocessors (630313)

Marking Scheme. Examination Paper. Module: Microprocessors (630313) Philadelphia University Faculty of Engineering Marking Scheme Examination Paper Department of CE Module: Microprocessors (630313) Final Exam Second Semester Date: 12/06/2017 Section 1 Weighting 40% of

More information

Instructions moving data

Instructions 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 information

ADVANCE MICROPROCESSOR & INTERFACING

ADVANCE 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 information

db "Please enter up to 256 characters (press Enter Key to finish): ",0dh,0ah,'$'

db 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 information

LABORATORY WORK NO. 7 FLOW CONTROL INSTRUCTIONS

LABORATORY 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 information

Microprocessor and Assembly Language Week-5. System Programming, BCS 6th, IBMS (2017)

Microprocessor 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 information

Intel 8086 MICROPROCESSOR ARCHITECTURE

Intel 8086 MICROPROCESSOR ARCHITECTURE Intel 8086 MICROPROCESSOR ARCHITECTURE 1 Features It is a 16-bit μp. 8086 has a 20 bit address bus can access up to 2 20 memory locations (1 MB). It can support up to 64K I/O ports. It provides 14, 16

More information

1-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

1-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 information

Jones & Bartlett Learning, LLC NOT FOR SALE OR DISTRIBUTION 80x86 Instructions

Jones & 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 information

PESIT Bangalore South Campus

PESIT 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 information

Selection and Iteration. Chapter 7 S. Dandamudi

Selection 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 information

Defining and Using Simple Data Types

Defining 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 information

Week /8086 Microprocessor Programming II

Week /8086 Microprocessor Programming II Week 5 8088/8086 Microprocessor Programming II Quick Review Shift & Rotate C Target register or memory SHL/SAL 0 C SHR 0 SAR C Sign Bit 2 Examples Examples Ex. Ex. Ex. SHL dest, 1; SHL dest,cl; SHL dest,

More information

ORG ; TWO. Assembly Language Programming

ORG ; 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 information

PESIT Bangalore South Campus Hosur road, 1km before Electronic City, Bengaluru -100 Department of Electronics and Communication

PESIT Bangalore South Campus Hosur road, 1km before Electronic City, Bengaluru -100 Department of Electronics and Communication USN 1 P E PESIT Bangalore South Campus Hosur road, 1km before Electronic City, Bengaluru -100 Department of Electronics and Communication INTERNAL ASSESSMENT TEST 1 Date : 26/02/2018 Marks: 40 Subject

More information

Microprocessor. By Mrs. R.P.Chaudhari Mrs.P.S.Patil

Microprocessor. By Mrs. R.P.Chaudhari Mrs.P.S.Patil Microprocessor By Mrs. R.P.Chaudhari Mrs.P.S.Patil Chapter 1 Basics of Microprocessor CO-Draw Architecture Of 8085 Salient Features of 8085 It is a 8 bit microprocessor. It is manufactured with N-MOS technology.

More information

Intel 8086 MICROPROCESSOR. By Y V S Murthy

Intel 8086 MICROPROCESSOR. By Y V S Murthy Intel 8086 MICROPROCESSOR By Y V S Murthy 1 Features It is a 16-bit μp. 8086 has a 20 bit address bus can access up to 2 20 memory locations (1 MB). It can support up to 64K I/O ports. It provides 14,

More information

APPENDIX C INSTRUCTION SET DESCRIPTIONS

APPENDIX 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 information

Lesson 1. Fundamentals of assembly language

Lesson 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 information

Chapter 3: Addressing Modes

Chapter 3: Addressing Modes Chapter 3: Addressing Modes Chapter 3 Addressing Modes Note: Adapted from (Author Slides) Instructor: Prof. Dr. Khalid A. Darabkh 2 Introduction Efficient software development for the microprocessor requires

More information

Assignment no:4 on chapter no :3 : Instruction set of 8086

Assignment no:4 on chapter no :3 : Instruction set of 8086 Assignment no:4 on chapter no :3 : Instruction set of 8086 1) Describe any two string operation instruction of 8086 with syntax & one example of each. 1] REP: REP is a prefix which is written before one

More information

EEM336 Microprocessors I. Data Movement Instructions

EEM336 Microprocessors I. Data Movement Instructions EEM336 Microprocessors I Data Movement Instructions Introduction This chapter concentrates on common data movement instructions. 2 Chapter Objectives Upon completion of this chapter, you will be able to:

More information

Logic Instructions. Basic Logic Instructions (AND, OR, XOR, TEST, NOT, NEG) Shift and Rotate instructions (SHL, SAL, SHR, SAR) Segment 4A

Logic 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 information

Basic Assembly SYSC-3006

Basic 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 information

Assembler lecture 4 S.Šimoňák, DCI FEEI TU of Košice

Assembler 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 information

Basic Assembly Instructions

Basic 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 information

X86 Addressing Modes Chapter 3" Review: Instructions to Recognize"

X86 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 information

Islamic 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 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 information

Lecture 16: Passing Parameters on the Stack. Push Examples. Pop Examples. CALL and RET

Lecture 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 information

CS401 Assembly Language Solved MCQS From Midterm Papers

CS401 Assembly Language Solved MCQS From Midterm Papers CS401 Assembly Language Solved MCQS From Midterm Papers May 14,2011 MC100401285 Moaaz.pk@gmail.com MC100401285@gmail.com PSMD01(IEMS) Question No:1 ( Marks: 1 ) - Please choose one The first instruction

More information

Integer Arithmetic Part2

Integer 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 information

.code. lea dx,msg2. Page 1/8. Problem 1: Programming in Assembly [25 Points]

.code. lea dx,msg2. Page 1/8. Problem 1: Programming in Assembly [25 Points] Problem : Programming in Assembly [ Points] The following assembly program is supposed to: receive three integer numbers from the console, call a function, name sort, function sort arranges the three input

More information

complement) Multiply Unsigned: MUL (all operands are nonnegative) AX = BH * AL IMUL BH IMUL CX (DX,AX) = CX * AX Arithmetic MUL DWORD PTR [0x10]

complement) Multiply Unsigned: MUL (all operands are nonnegative) AX = BH * AL IMUL BH IMUL CX (DX,AX) = CX * AX Arithmetic MUL DWORD PTR [0x10] The following pages contain references for use during the exam: tables containing the x86 instruction set (covered so far) and condition codes. You do not need to submit these pages when you finish your

More information

ASSEMBLY LANGUAGE PROGRAMMING OF THE MICROCOMPUTER

ASSEMBLY LANGUAGE PROGRAMMING OF THE MICROCOMPUTER CHAPTER ASSEMBLY LANGUAGE PROGRAMMING OF THE MICROCOMPUTER 2.1 Introduction To run a program, a microcomputer must have the program stored in binary form in successive memory locations. There are three

More information

SHEET-2 ANSWERS. [1] Rewrite Program 2-3 to transfer one word at a time instead of one byte.

SHEET-2 ANSWERS. [1] Rewrite Program 2-3 to transfer one word at a time instead of one byte. SHEET-2 ANSWERS [1] Rewrite Program 2-3 to transfer one word at a time instead of one byte. TITLE PROG2-3 PURPOSE: TRANSFER 6 WORDS OF DATA PAGE 60,132.MODEL SMALL.STACK 64.DATA ORG 10H DATA_IN DW 234DH,

More information

Chapter Four Instructions Set

Chapter Four Instructions Set Chapter Four Instructions set Instructions set 8086 has 117 instructions, these instructions divided into 6 groups: 1. Data transfer instructions 2. Arithmetic instructions 3. Logic instructions 4. Shift

More information

Assembling, Linking and Executing 1) Assembling: .obj obj .obj.lst .crf Assembler Types: a) One pass assembler:

Assembling, Linking and Executing 1) Assembling: .obj obj .obj.lst .crf Assembler Types: a) One pass assembler: Assembling, Linking and Executing 1) Assembling: - Assembling converts source program into object program if syntactically correct and generates an intermediate.obj file or module. - It calculates the

More information

3.1 DATA MOVEMENT INSTRUCTIONS 45

3.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 information

SRI VENKATESWARA COLLEGE OF ENGINEERING AND TECHNOLOGY DEPARTMENT OF ECE EC6504 MICROPROCESSOR AND MICROCONTROLLER (REGULATION 2013)

SRI VENKATESWARA COLLEGE OF ENGINEERING AND TECHNOLOGY DEPARTMENT OF ECE EC6504 MICROPROCESSOR AND MICROCONTROLLER (REGULATION 2013) SRI VENKATESWARA COLLEGE OF ENGINEERING AND TECHNOLOGY DEPARTMENT OF ECE EC6504 MICROPROCESSOR AND MICROCONTROLLER (REGULATION 2013) UNIT I THE 8086 MICROPROCESSOR PART A (2 MARKS) 1. What are the functional

More information

UNIT 4. Modular Programming

UNIT 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 information

Module 3 Instruction Set Architecture (ISA)

Module 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 information

Conditional Processing

Conditional Processing ١ Conditional Processing Computer Organization & Assembly Language Programming Dr Adnan Gutub aagutub at uqu.edu.sa Presentation Outline [Adapted from slides of Dr. Kip Irvine: Assembly Language for Intel-Based

More information

UNIT III MICROPROCESSORS AND MICROCONTROLLERS MATERIAL OVERVIEW: Addressing Modes of Assembler Directives. Procedures and Macros

UNIT III MICROPROCESSORS AND MICROCONTROLLERS MATERIAL OVERVIEW: Addressing Modes of Assembler Directives. Procedures and Macros OVERVIEW: UNIT III Addressing Modes of 8086 Assembler Directives Procedures and Macros Instruction Set of 8086 Data Transfer Group Arithmetic Group Logical Instructions Rotate and Shift instructions Loop

More information

EC 333 Microprocessor and Interfacing Techniques (3+1)

EC 333 Microprocessor and Interfacing Techniques (3+1) EC 333 Microprocessor and Interfacing Techniques (3+1) Lecture 7 8086/88 Microprocessor Programming (Data Movement Instructions) Dr Hashim Ali Spring 2018 Department of Computer Science and Engineering

More information

Assembly Language: IA-32 Instructions

Assembly 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 information

CC411: Introduction To Microprocessors

CC411: 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 information

Lecture 8: Control Structures. Comparing Values. Flags Set by CMP. Example. What can we compare? CMP Examples

Lecture 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 information

8086 Programming ADD BX,245FH BX BX + 245FH ADD [BX],AL [DS:BX] [DS:BX] + AL ADD CL,[BP] CL CL + [SS:BP] ADD BX,[SI + 2] BX BX + [DS:(SI + 3:SI + 2)]

8086 Programming ADD BX,245FH BX BX + 245FH ADD [BX],AL [DS:BX] [DS:BX] + AL ADD CL,[BP] CL CL + [SS:BP] ADD BX,[SI + 2] BX BX + [DS:(SI + 3:SI + 2)] Addition Instruction 8086 Programming The table illustrates the addressing modes available to the ADD instruction. These addressing modes include almost all addressing modes. The only types of addition

More information

UNIT 2 PROCESSORS ORGANIZATION CONT.

UNIT 2 PROCESSORS ORGANIZATION CONT. UNIT 2 PROCESSORS ORGANIZATION CONT. Types of Operand Addresses Numbers Integer/floating point Characters ASCII etc. Logical Data Bits or flags x86 Data Types Operands in 8 bit -Byte 16 bit- word 32 bit-

More information

Experiment 3. TITLE Optional: Write here the Title of your program.model SMALL This directive defines the memory model used in the program.

Experiment 3. TITLE Optional: Write here the Title of your program.model SMALL This directive defines the memory model used in the program. Experiment 3 Introduction: In this experiment the students are exposed to the structure of an assembly language program and the definition of data variables and constants. Objectives: Assembly language

More information

Assembly Language. Dr. Esam Al_Qaralleh CE Department Princess Sumaya University for Technology. Overview of Assembly Language

Assembly Language. Dr. Esam Al_Qaralleh CE Department Princess Sumaya University for Technology. Overview of Assembly Language 4345 Assembly Language Assembly Language Dr. Esam Al_Qaralleh CE Department Princess Sumaya University for Technology Assembly Language 3-1 Overview of Assembly Language Advantages: Faster as compared

More information

EXPERIMENT WRITE UP. LEARNING OBJECTIVES: 1. Get hands on experience with Assembly Language Programming 2. Write and debug programs in TASM/MASM

EXPERIMENT 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 for 16 bit BCD addition LEARNING OBJECTIVES: 1. Get hands on experience with Assembly Language Programming 2. Write and debug programs in TASM/MASM TOOLS/SOFTWARE

More information

22 Assembly Language for Intel-Based Computers, 4th Edition. 3. Each edge is a transition from one state to another, caused by some input.

22 Assembly Language for Intel-Based Computers, 4th Edition. 3. Each edge is a transition from one state to another, caused by some input. 22 Assembly Language for Intel-Based Computers, 4th Edition 6.6 Application: Finite-State Machines 1. A directed graph (also known as a diagraph). 2. Each node is a state. 3. Each edge is a transition

More information

IFE: Course in Low Level Programing. Lecture 6

IFE: 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 information

CONTENTS. 1. Display a Message Display a one Digit Number Accept a Character from keyboard and display the character 4

CONTENTS. 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 information

TUTORIAL. Emulador Emu8086 do. Microprocessador 8086

TUTORIAL. Emulador Emu8086 do. Microprocessador 8086 1 TUTORIAL Emulador Emu8086 do Microprocessador 8086 2 8086 Assembler Tutorial for Beginners (Part 1) This tutorial is intended for those who are not familiar with assembler at all, or have a very distant

More information

ECOM Computer Organization and Assembly Language. Computer Engineering Department CHAPTER 7. Integer Arithmetic

ECOM 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 information

Integer Arithmetic. Pu-Jen Cheng. Adapted from the slides prepared by Kip Irvine for the book, Assembly Language for Intel-Based Computers, 5th Ed.

Integer Arithmetic. Pu-Jen Cheng. Adapted from the slides prepared by Kip Irvine for the book, Assembly Language for Intel-Based Computers, 5th Ed. Computer Organization & Assembly Languages Integer Arithmetic Pu-Jen Cheng Adapted from the slides prepared by Kip Irvine for the book, Assembly Language for Intel-Based Computers, 5th Ed. Chapter Overview

More information

CSC 2400: Computer Systems. Towards the Hardware: Machine-Level Representation of Programs

CSC 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 information

CSC 8400: Computer Systems. Machine-Level Representation of Programs

CSC 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 information

Computer Architecture..Second Year (Sem.2).Lecture(4) مدرس المادة : م. سندس العزاوي... قسم / الحاسبات

Computer 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 information

CS/ECE/EEE/INSTR F241 MICROPROCESSOR PROGRAMMING & INTERFACING MODULE 4: 80X86 INSTRUCTION SET QUESTIONS ANUPAMA KR BITS, PILANI KK BIRLA GOA CAMPUS

CS/ECE/EEE/INSTR F241 MICROPROCESSOR PROGRAMMING & INTERFACING MODULE 4: 80X86 INSTRUCTION SET QUESTIONS ANUPAMA KR BITS, PILANI KK BIRLA GOA CAMPUS CS/ECE/EEE/INSTR F241 MICROPROCESSOR PROGRAMMING & INTERFACING MODULE 4: 80X86 INSTRUCTION SET QUESTIONS ANUPAMA KR BITS, PILANI KK BIRLA GOA CAMPUS Q1. IWrite an ALP that will examine a set of 20 memory

More information

Computer Architecture and System Software Lecture 04: Floating Points & Intro to Assembly

Computer 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 information

Q1: Multiple choice / 20 Q2: Protected mode memory accesses

Q1: Multiple choice / 20 Q2: Protected mode memory accesses 16.317: Microprocessor-Based Systems I Summer 2012 Exam 2 August 1, 2012 Name: ID #: For this exam, you may use a calculator and one 8.5 x 11 double-sided page of notes. All other electronic devices (e.g.,

More information

PESIT Bangalore South Campus

PESIT Bangalore South Campus INTERNAL ASSESSMENT TEST 2 Date : 28/03/2016 Max Marks: 50 Subject & Code : Microprocessor (10CS45) Section: IV A and B Name of faculty: Deepti.C Time: 8:30-10:00 am Note: Answer any complete five questions

More information

Q1: Define a character string named CO_NAME containing "Internet Services" as a constant?

Q1: Define a character string named CO_NAME containing Internet Services as a constant? CS 321 Lab Model Answers ١ First Lab : Q1: Define a character string named CO_NAME containing "Internet Services" as a constant? ANS: CO_NAME EQU ' Internet Services' Q2: Define the following numeric values

More information

Computer Architecture and System Programming Laboratory. TA Session 3

Computer Architecture and System Programming Laboratory. TA Session 3 Computer Architecture and System Programming Laboratory TA Session 3 Stack - LIFO word-size data structure STACK is temporary storage memory area register points on top of stack (by default, it is highest

More information

Lecture 5:8086 Outline: 1. introduction 2. execution unit 3. bus interface unit

Lecture 5:8086 Outline: 1. introduction 2. execution unit 3. bus interface unit Lecture 5:8086 Outline: 1. introduction 2. execution unit 3. bus interface unit 1 1. introduction The internal function of 8086 processor are partitioned logically into processing units,bus Interface Unit(BIU)

More information

Introduction to IA-32. Jo, Heeseung

Introduction to IA-32. Jo, Heeseung Introduction to IA-32 Jo, Heeseung IA-32 Processors Evolutionary design Starting in 1978 with 8086 Added more features as time goes on Still support old features, although obsolete Totally dominate computer

More information