0% found this document useful (0 votes)
16 views3 pages

Student ID: MC190407267 Name: Mehwish Qandil: Assignment

Uploaded by

Hasnain ali
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
16 views3 pages

Student ID: MC190407267 Name: Mehwish Qandil: Assignment

Uploaded by

Hasnain ali
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

Assignment No.

01
Semester: Spring 2021 Solution
CS609 System Programming

Student ID: MC190407267

Name: Mehwish Qandil

Assignment

Question No 1: 10 Marks
Reading Carry flag’s value using INTDOS() and REGS Union
Write a C language Function that will perform the following:
 Place last digit of your Student ID in AH register and second last digit of your
Student ID in DL register (by using REGS Union only)
 After that, read the value of Carry flag by using INTDOS() function
o If carry flag is set, print your Student ID, and
o If carry flag is not set, print your complete name
Solution:
#include <dos.h> // for intdos() and union REGS

#include <stdio.h> // for printf ()


union REGS inregs, outregs;
void mian()
{
inregs.h.ah = 0x6; inregs.h.al = 0x0;
intdos(&inregs, &outregs);
if(regs.x.cflag==1)
printf(“My Student ID is MC190407267”);
else
printf(“My Name is Mehwish Qandil”);
getch();
}

Question 2: Calculating value of AX from AH and AL 5 Marks


In Intel 8088/8086, the general-purpose register AX consists of two parts, the high-part AH and the low-
part AL. Suppose AH contains 10 and AL contains 116. Calculate the value of AX (show all calculations).

Solution:

#include <dos.h> // for intdos() and union REGS

#include <stdio.h> // for printf ()


union REGS regs;
void mian(void)
{
regs.h.al = 0x116;

regs.h.ah = 0x10;

printf(“%x”, regss.x.ax);
}

Output/Result: 10116

You might also like