CS401 Assignment 3 Solution Feb 2015

Question # 1:

Write a complete assembly language program that will take inputs from keyboard using keyboard interrupt mechanism and will display the Extended ASCII codes corresponding to each key which has been pressed.

Note: You have to use only the Keyboard interrupt mechanism to take input from keyboard using an infinite loop.

Solution:

[org 0x100]

jmp start

ID: db ‘Mc130400536’,

Name: db ‘Humda’,

University Name: db ‘Virtual University’,

clrscr: push es

push ax

push cx

push di

mov ax, 0xb800

mov es, ax

xor di, di

mov ax, 0x0720

mov cx, 2000

cld

rep stosw

pop di

pop cx

pop ax

pop es

ret

printstr: push bp

mov bp, sp

push es

push ax

push cx

push si

push di

push ds

mov ax, [bp+4]

push ax

call strlen

cmp ax, 0

jz exit

mov cx, ax

mov ax, 0xb800

mov es, ax

mov al, 80

mul byte [bp+8]

add ax, [bp+10]

shl ax, 1

mov di,ax

mov si, [bp+4]

mov ah, [bp+6]

cld

nextchar: lodsb

stosw

loop nextchar

exit: pop di

pop si

pop cx

pop ax

pop es

pop bp

ret 8

strlen: push bp

mov bp,sp

push es

push cx

push di

les di, [bp+4]

mov cx, 0xffff

xor al, al

repne scasb

mov ax, 0xffff

sub ax, cx

dec ax

pop di

pop cx

pop es

pop bp

ret 4

start:

call clrscr ; call the clrscr subroutine

mov ax, 30

push ax ; push x position

mov ax, 20

push ax ; push y position

mov ax, 0x60 ; yellow on black attribute

push ax ; push attribute

mov ax, id

push ax ; push address of id

call printstr ; call the printstr subroutine

mov ax, 40

push ax ; push x position

mov ax, 30

push ax ; push y position

mov ax, 0x47 ; red on white background attribute

push ax ; push attribute

mov ax, name

push ax ; push address of message

call printstr

mov ax, 50

push ax ; push x position

mov ax, 40

push ax ; push y position

mov ax, 0x61 ;blue on yellow background attribute

push ax ; push attribute

mov ax, university name

push ax ; push address of message

call printstr

mov ax, 0x4c00 ; terminate program

int 0x21

Question # 2:

Explain how the computer determines which (Peripheral Component Interconnect) PCI devices are assigned to which interrupt requests (IRQ). Moreover highlight the working problem that generally faces by PCI.

Solution: PCI (Peripheral Component Interconnect) is an interconnection system between a microprocessor and attached devices in which expansionslots are spaced closely for high speed operation. Using PCI, a computer can support both new PCI cards while continuing to support Industry Standard Architecture (ISA) expansion cards, an older standard. Designed by Intel, the original PCI was similar to the VESA Local Bus. However, PCI 2.0 is no longer a local bus and is designed to be independent of microprocessor design. PCI is designed to be synchronized with the clock speed of the microprocessor.

DOWNLOAD SOLUTION HERE
loading...