CS609 Assignment 01 Spring 2021 Solution / Discussion
Share the Assignment Questions & Discuss Here....
Stay touched with this discussion, Solution idea will be uploaded as soon as possible in replies here before the due date.
Spring 2021CS609: System Programming Graded Assignment No. 01Total Marks: 15 Due Date:19thMay 2021Instructions:
Please read the following instructions carefully before submitting assignment. It should be clear that your assignment will not get any credit if:
▪The submitted assignment does not open or file is corrupt.
▪You have not followed all steps described in bothquestions
▪Assignment is copied(partial or full) from any source (websites, forums, students, etc.) Strict action will be taken in this regard.Note:You mustupload only a SINGLE Word document (.doc or .docx). In Question 1, only code of the function is required written in Word file. There is no need to attach screenshot. If you provide screenshots, it will not carry any marks. Question 2 requires complete calculations (if any).Objectives:The objective of this assignment is to provide hands-on experience of System Programming concepts including:•How to invoke softwareinterrupt
•Concept of REGS Union•Calculating values of general-purpose registers
Question 1: Reading Carry flag’s value using INTDOS()and REGSUnion(10 MARKS)Write a C language Functionthat 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 Uniononly)
•After that, read the value of Carry flag by using INTDOS()function
oIf carry flag is set, print your Student ID,and
oIf carry flag is not set, print your complete name
Detailed Instructions:All the necessary information is given below:
1)Information about INTDOS()function:INTDOS()function’s signature is:int intdos(union REGS *in_regs, union REGS *out_regs);This function sets the register values as given in in_regsand then calls DOS system call 0x21. On return, out_regsis set to the value of the system registers.
2)REGS Union:The complete REGS union is defined in DOS.H header file and it is available in lecture 2 (page 17 of handouts). Assume there is a cFlagvariable defined in FULLstruct....unsigned int cflag;...
3)After invokingINTDOS()function, if carry flag is set, printyour complete Student ID and if carry flag is not set, print your complete name.
4)Sample Output:The output of this function may look like:(Screenshots in solution are not required. Screenshots do not carry any marks. Only code of the function is required)
Checking Carry flag = SET
My Student ID is BC123456789
Checking Carry flag = NOT-SET
My name is Muhammad Umair
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).
---BEST OF LUCK---
#include<iostream> // for intdos() and union REGS
#include<stdio.h> // for printf()
Union REGS in_regs, out_regs;
Printf(“ MY STUDENT ID is mc170402900”);
Printf(“MY NAME IS SANA”);
#include<dos.h> //for intdos() and union REGS
#include<stdio.h> //for printf()
Union REGS regs;
Click on the below link to download the file