BIOS and DOS Interrupts
Dr. Tim McGuire
CS 272
Sam Houston State University
Overview Hardware Interrupt Questions to be Answered Acknowledging an Interrupt Transferring to an Interrupt Routine Software Interrupt INT interrupt_number Processor Exception Interrupt Numbers Interrupt Types Interrupt Types    Description

     0h-1Fh         BIOS Interrupts
    20h-3Fh         DOS Interrupts
    40h-7Fh         reserved
    80h-F0h         ROM BASIC
    F1h-FFh         not used

Interrupt Vector Interrupt Vector Table Accessing the Vector Example Interrupt Routines The Control Flag TF The Control Flag IF BIOS Interrupts Interrupt Types 10h - 1Fh


Equipment Check

15-14     Number of printers installed
13 = 1    if internal modem installed
12 = 1    if game adapter installed
11-9      Number of serial ports installed
8         not used
7-6       Number of floppy drives (if bit 0=1)
                00=1, 01=2KB, 10=3, 11=4
5-4       Initial video mode
                00=not used, 01=40x25 color,
                10=80x25 color, 11=80x25 monochrome
3-2       System board RAM size (original PC)
                00=16KB, 01=32KB, 10=48KB, 11=64KB
1 = 1     if math coprocessor installed
0 = 1     if floppy drive installed
Interrupt Types 10h - 1Fh DOS Interrupts DOS Interrupts 20h-27h A Time Display Program Clock at Power-up INT 21h, Function 2Ch How the Program Works Program Listing (timedsp1.asm) %TITLE "TIME_DISPLAY_VER_1"
;program that displays the current time
    IDEAL
    MODEL small
    STACK 100h
    DATASEG
TIME_BUF DB '00:00:00$'   ;time buffer hr:min:sec
    CODESEG
Start:
    mov AX,@data
    mov DS,AX             ;initialize DS
;get and display time
    lea BX,[TIME_BUF]     ;BX points to TIME_BUF
    call GET_TIME         ;put current time in TIME_BUF
    lea DX,[TIME_BUF]     ;DX points to TIME_BUF
    mov AH,09h            ;display time
    int 21h
;exit
    mov AH,4Ch            ;return
    int 21h               ;to DOS
Procedure GET_TIME PROC GET_TIME NEAR
;get time of day and store ASCII digits in time buffer
;input: BX = address of time buffer
    mov AH,2Ch            ;gettime
    int 21h               ;CH = hr, CL = min, DH = sec
;convert hours into ASCII and store
    mov AL,CH             ;hour
    call CONVERT          ;convert to ASCII
    mov [BX],AX           ;store
;convert minutes into ASCII and store
    mov AL,CL             ;minute
    call CONVERT          ;convert to ASCII
    mov [BX+3],AX         ;store
;convert seconds into ASCII and store
    mov AL,DH             ;second
    call CONVERT          ;convert to ASCII
    mov [BX+6],AX         ;store
    ret

ENDP GET_TIME

Procedure CONVERT PROC CONVERT
;converts byte number (0-59) into ASCII digits
;input: AL = number
;output: AX = ASCII digits, AL = high digit, AH = low digit
    mov AH,0             ;clear AH
    mov DL,10            ;divide AX by 10
    div DL               ;AH has remainder, AL has quotient
    or AX,3030h          ;convert to ASCII, AH has low digit
    ret                  ;AL has high digit
ENDP CONVERT
;

END Start

User Interrupt Procedures INT 8 and INT 1Ch Set Interrupt Vector INT 21h, Function 25h INT 21h, Function 35h Procedure SETUP_INT Cursor Control INT 10h, Function 2 Described in I/O module, repeated here for convenience INT 10h, Function 3 Described in I/O module, repeated here for convenience Interrupt Procedure DISPTIME2.ASM Setting and Restoring the Interrupt Vector The TIME_INT Routine Outline of the Program Assembling and Linking tlink timedsp2 setupint gettime Memory Resident Program Terminating a TSR INT 27h INT 16h, Function 2 bit       meaning

7=1     Insert on
6=1     Caps Lock on
5=1     Num Lock on
4=1     Scroll Lock on
3=1     Alt key down
2=1     Ctrl key down
1=1     Left shift key down
0=1     Right shift key down
 
 

tlink /t timedsp3 savescrn gettime2 initlze