Sie sind auf Seite 1von 2

Assembly Language (A&B)

Spring 2018
Assignment-1
Submission: Monday 12th Feb, 2018 (In lab to Mr. Awais Naeem)

Submit hard copy of the assignment. Assembly programs should be print outs of .asm files. (not
hand written).

Instructions Flags
S Z C O P A
ADD Add: dest  dest + source      
AND And: dest  dest .AND. source   0 0  ?
DEC Decrement. dest  dest – 1     
INC Dest  dest + 1     
MOV dest  operand or data stored at operand address
NEG dest  - dest      
NOT dest  complement{dest}
OR dest  dest .OR. source   0 0  ?
SUB dest  dest – source      
XOR dest  dest .XOR. source   0 0  ?

Codes:
Q1. Given a 16-bit unsigned odd number, convert it to even number using “and” and “mov”
only.

Q2. Given a 16-bit unsigned even number, convert it to odd number using “or” and “mov” only.

Q3. Perform the subtraction A-B using “mov”, “add”, “xor” instructions only.

Q4. Write a program to add first two digits of your roll no. to last two digits, treating it as a hexa
decimal number. For example, 16-4012 is placed in al= 0x0012 and in ah=0x0040. Add both
numbers (8-bit addition) and store the result in ah. Write in comments at the end of code values
of following flags after addition: CF, OF, SF, ZF, PF, AF

Handwritten:

Q5. Suppose CS=0x19F5 and IP=0x0FD0 and offset of DS is=0x2F10, then what should value
in DS to access the same memory location as CS:IP? (Segments are overlapping)

Q6. Question number 14 from exercise of chapter 1

Q7. Question number 18 from exercise of chapter 1

Q8. Question number 19 from exercise of chapter 1

Assembly Language Programming Assign-1 Page 1


Explore: (to be submitted as a print-out, with equ and $ description and some assembly
code as an example)

Q9. What does equ and $ does in assembly? Write one example/reason of using them in
assembly.

Assembly Language Programming Assign-1 Page 2