Sanee Rashid Assembly Language Programming.pdf

October 26, 2017 | Author: esotric | Category: Assembly
Share Embed

Short Description

Download Sanee Rashid Assembly Language Programming.pdf...


  1  | P a g e   COMSATS-Lancaster Dual Degree Programme . CIIT, 1.5KM Defence Road, Off Raiwind Road, Lahore.    Name : Ahmed Daud   Registration Number : CIIT/DDP-FA10-BTE-002/LHR    Email : [email protected]    Semester : 6 Section : DDP   Department : Electrical Engineering   Course Title : Lab  - Microprocessor Systems & Interfacing   Course Code : EEE342   Assignment Number : 1   Assignment Topic : Assembly Language Programming   Course Book : Assembly Language by Ytha Yu   Submission Date : February 27, 2013 Submitted To : Engr. Mr. Usman Rafique     2  | P a g e   TABLE OF CONTENTS QUESTION #   PAGE #   Q # 1 3 Q # 2 4 Q # 3 5 References 6   3  | P a g e   QUESTION NO. 1   Identify the incorrect instructions in the following code segment of 8086-88 assembly language. SOLUTION:   MOV AX, BX ; COPY THE CONTENTS OF BX IN AX MUL CX ; THE FIRST OPERAND IS ASSUMED TO BE IN AX MOV DX, [45ABH] ; COPY THE CONTENT OF MEMORY LOCATION [45ABH] IN DX MOV [256AH], DX ; CAN NOT ACCESS TWO MEMORIES AT THE SAME TIME XCHG BX, [236] ; XCHNG IS WRONG ALSO NO CONSTANT ALLOWED. ; IT EXCHANGES THE CONTENTS OF REGISTERS OR MEMORY MOV AX, 12H ; COPY 12H IN AX FOR DIVISION DIV AL ; 8-BIT DIVISION USING DIV INSTRUCTION REQUIRES AX FOR DIVIDEND ; AND AN OPERAND FOR THE DIVISOR. XOR [1256H], BX ; IT XOR MEMORY [1256H] AND BX AND STORE THE RESULT IN LOC [1256H] MOV AX, 1234H ; LOAD THE NUMBER INTO A REGISTER, THEN USE THE NEG INSTRUCTION NEG AX ; ONLY REGISTERS OR MEMORY LOCATION ALLOWED. ; NEG COMPUTES THE TWO'S COMPLEMENT   4  | P a g e   QUESTION NO. 2   Write an 8086-88 assembly language program to convert the Celsius reading into the Fahrenheit reading. Celsius reading is found in AL register and Fahrenheit reading is to be placed in AH register. SOLUTION: ; We will convert Celsius to Fahrenheit using formula: f = c * 9 / 5 + 32. ORG 100H MOV BL, AL ; CELSIUS READING IS FOUND IN AL REGISTER. MOV AL, 9 ; COPY 9 IN AL. IMUL BL ; MULTIPLY BL WITH AL I.E 9 AND STORE IN AL. MOV BL, 5 ; COPY 5 IN BL. IDIV BL ; DIVIDE AL WITH BL AND STORE IN AL. ADD AL, 32 ; ADD 32 IN AL. MOV AH, AL ; FAHRENHEIT READING IS TO BE PLACED IN AH REGISTER. RET ; RETURN TO THE OPERATING SYSTEM.   5  | P a g e   QUESTION NO. 3   Write an 8086-88 assembly language program that clears a specific bit in BX register. Number of the bit which is to be cleared (from 0 to 15) is placed in AL. Program should clear only desired bit leaving other bits unchanged. SOLUTION: MOV DX, 0001H ; COPY 1 IN DX. MOV CL, AL ; AS ONLY IMMEDIATE BYTE OR CL CAN BE USED AS SECOND PARAMETER IN SHL. SHL DX, CL ; SHL INSTRUCTION SHIFTS THE BITS IN DX TO CL TIMES LEFT. NOT DX ; TAKE 1’S COMPLEMENT OF DX I.E. INVERT THE BITS OF DX. AND BX, DX ; AND BX WITH DX TO CLEAR AL BIT. RET ; RETURN TO THE OPERATING SYSTEM.  ALTERNATE SOLUTION: MOV DX, 0FFFEH MOV CL, AL ROL DX, CL AND BX, DX   6  | P a g e   REFERENCES      Assembly language programming and organization of the IBM PC by Ytha Y. Yu, Charles Marut    The 80x86 IBM PC and compatible computers: Assembly language, design, and interfacing by Muhammad Ali Mazidi, Janice Gillispie Mazidi    Assembly Language for Intel-Based Computers by Kip R. Irvine    The Intel Microprocessors: 8086/8088, 80186/80188, 80286, 80386, 80486, Pentium, Pentium Pro, and Pentium II Processors : Architecture, Programming, and Interfacing by Barry B. Brey    Assembly language programming for the Intel 80XXX family by William B. Giles    The 80x86 IBM PC and Compatible Computers (Vol 1 and Vol 2)    Microcomputer Systems: The 8086/8088 Family    Online Materials    Intel Developers website    AIX-86 (8086) Datasheet     
View more...


Copyright © 2017 DOCTUTS.COM Inc.