Assembly Language

Practical Three

due date : 4pm 19 March 1996

Complete the attached sample program, to output BIOS information about the computer.

Extract and output the following data from your program:

Use IOASM for integer output procedures.

Submit the source files, executable files and output screen dumps.

Check up a hardware reference manual such as HELPPC for technical documentation on the interrupts used.

The sample program can be downloaded from the following location :
http://elf.udw.ac.za/cs/sampprog/cs2/asm-1996/prac4.asm

You ought to be submitting three files for this practical.

Sample Program

; system information
DOSSEG
.MODEL SMALL
.STACK 4096

.DATA
StartMessage db 'BIOS Equipment Checker',13,10
db '----------------------',13,10,'$'
NoMathMessage db 'No math coprocessor',13,10,'$'
YesMathMessage db 'Math coprocessor installed',13,10,'$'
PrintersMessage db 'No of printers attached = ','$'
InitVideoMessage db 'Initial video mode = ','$'
VideoModes db '40x25 color ','$'
VideoModeFlag db '80x25 color ','$'
db '80x25 monochrome','$'

.CODE

EXTRN readsint:proc,writesint:proc
; use procedure from IOASM to output numbers to screen

ProgramStart:
mov ax,SEG _DATA ; set up data segment
mov ds,ax

lea dx,StartMessage ; output startup message
mov ah,9
int 21h

int 11h ; get equipment list

push ax ; save equipment list value
and ax,0002h ; mask out math coprocessor bit
cmp ax,0 ; check for coprocessor
je nomath
lea dx,YesMathMessage ; set true message pointer
jmp endmath
nomath:
lea dx,NoMathMessage ; set false message pointer
endmath:
mov ah,9 ; output message
int 21h
pop ax ; restore equipment list value

push ax ; save equipment list value
and ax,0C000h ; mask out printer bits
mov cl,2 ; shift bits to l.s. position
rol ax,cl
push ax ; save noofprinters
lea dx,PrintersMessage
mov ah,9
int 21h ; output fixed part of message
pop ax ; restore noofprinters
call writesint ; output noofprinters
pop ax ; restore equipment list value

push ax ; save equipment list value
and ax,0030h ; mask out video mode bits
mov cl,4 ; shift bits to l.s. position
shr ax,cl
push ax ; save video mode
lea dx,InitVideoMessage
mov ah,9
int 21h ; output fixed part of message
pop ax ; restore video mode
dec ax ; skip "unused" entry
lea dx,VideoModes ; load start of mode table
startvideoadd:
cmp ax,0 ; loop to find actual table entry
je endvideoadd
add dx,VideoModeFlag-VideoModes ; increment offset into table
dec ax ; decrement mode value
jmp startvideoadd
endvideoadd:
mov ah,9
int 21h ; output video mode
pop ax ; restore equipment list value

mov ah,4ch ; terminate program
int 21h

END ProgramStart