CS401 Finalterm Solved paper 2013 File 13 Shared by Sana Rajpoot

No Comments

CS401 Solved Paper 27 Feb2013 at 11:00am

Q1:   Describe the structure of “Device Driver File” which is used for device management?       2 Marks

ANS:  Device driver file starts with a header containing a link to the next driver in the first four bytes followed by a device attribute word. The most important bit in the device attribute word is bit 15 which dictates if it is a character device or a block device. If the bit is zero the device is a character device and otherwise a block device. Page 158

Q2:   Why trap flag has a special relation with interrupt and debugger?       2 Marks

ANS:  INT 1 is used in debugging with the trap flag. If the trap flag is set the Single Step Interrupt is generated after every instruction. So INT 1 relates to trap flag.

Q3:   Whether the relation b/w RET and CALL is dependent or independent?       2 Marks

ANS:  Both the instructions are commonly used as a pair, however technically they are independent in their operation. The RET works regardless of the CALL and the CALL works regardless of the RET. If you CALL a subroutine it will not complain if there is no RET present and similarly if you RET without being called it won’t complain. Page 56

Q4:   Who is responsible for clear the stack in C and Pascal calling conventions? 2 Marks

ANS:  In C the caller removes the parameter while in Pascal the callee removes them.   Page 179

Q5:  What are the important “command code” in request header of device driver? 3Marks

ANS:  Important command codes include 0 to initialize, 1 to check media, 2 to build a BIOS parameter block, 4 and 8 for read and write respectively. Page 158

Q6:   Write command to accomplish following tasks in AFD:
a)      Command to view stack from an offset address 0x20 in “Memory Window 1”?
b)      Command to change DX register content to 0x45?    3 Marks

ANS:

Q7:   Which attribute of INT10 being used for getting information about Super VGA?       3 Marks

ANS:    page 172
INT 10 – VESA – Get SuperVGA Infromation
AX = 4F00h
ES:DI -> buffer for SuperVGA information
Return:
AL = 4Fh if function supported
AH = status

Q8:   Which pins are used in Serial Port? Which type of communication is in it?  5 Marks

ANS:  page 163
  1. Carrier Detect
  2. Received Data
  3. Transmitted Data
  4. Data Terminal Ready
  5. Signal Ground
  6. Data Set Ready
  7. Request to send
  8. Clear to Send
  9. Ring Indicator

Serial port is a way of communication among two devices just like the parallel port. The basic difference is that whole bytes are sent from one place to another in case of parallel port while the bits are sent one by one on the serial port in a specially formatted fashion.

Q9:   What is the function of “segment override prefix” and what changes it brings to opcode?       5 Marks

ANS:  To override the association for one instruction of one of the registers BX, BP, SI or DI, we use the segment override prefix. For example “mov ax, [cs:bx]” associates BX with CS for this one instruction. For the next instruction the default association will come back to act. The processor places a special byte before the instruction called a prefix. Page 26.

Q10:   Draw a half straight line in graphics mode middle of the screen from extreme left to right?       5 Marks

ANS:  ; draw line in graphics mode
[org 0x0100]
mov ax, 0x000D ; set 320x200 graphics mode
int 0x10 ; bios video services
mov ax, 0x0C07 ; put pixel in white color
xor bx, bx ; page number 0
mov cx, 200 ; x position 200
mov dx, 200 ; y position 200
l1: int 0x10 ; bios video services
dec dx ; decrease y position
loop l1 ; decrease x position and repeat
mov ah, 0 ; service 0 – get keystroke
int 0x16 ; bios keyboard services
mov ax, 0x0003 ; 80x25 text mode
int 0x10 ; bios video services
mov ax, 0x4c00 ; terminate program
int 0x21                                                  page 144

Q11:   Using the function “int multiply (int x, int y)” from C and convert it into assembly code?       5 Marks

ANS:  page 179
push dword [myy]
push dword [myx]
call _ multiply
add esp, 8
; EAX holds the answer

Next PostNewer Post Previous PostOlder Post Home

0 comments

Post a Comment