Real-Mode Initialization Example

The following example shows a typical real-mode initialization procedure:


;*********************************************************************
; Real-mode initialization code
;*********************************************************************

VxD_REAL_INIT_SEG

BeginProc ebios_init
    mov    ah, 0C0h
    int    15h
    test    es:[bx.SD_feature1], EBIOS_allocated
    jz    short no_ebios_fnd
    mov    ah, 0C1h                  ; get segment adr of EBIOS
    int    15h
    jc    short no_ebios_fnd
    mov    ax, es                    ; get EBIOS segment address
    shr    ax, 8                     ; convert to a page number
    movzx    edx, ax                 ; return EBIOS page as reference 
                                     ;  data
    mov    bx, OFFSET exc_ebios_page ; pointer to exclusion table
    mov    [bx], ax                  ; 1 entry, to exclude EBIOS page
                                     ; from memory manager use
    xor    si, si                    ; no instance data to declare
    mov    ax, Device_Load_Ok        ; go ahead and load the device
    jmp    short init_exit           ; return to loader

no_ebios_fnd:
    mov    ah, 9
    mov    dx, OFFSET no_ebios_msg   ; print message through MS-DOS
    int    21h
    xor    bx, bx                    ; no exclusion table
    xor    si, si                    ; no instance data table
    xor    edx, edx                  ; no reference data
    mov    ax, Abort_Device_Load + No_Fail_Message
                                     ; don't load protected-mode
                                     ; portion and don't display a
                                     ; failure message
init_exit:
    ret

exc_ebios_page    dw  0, 0

no_ebios_msg  db 'PS/2 type EBIOS not detected', 13, 10, '$'

EndProc ENDP

VxD_REAL_INIT_ENDS