1 ;-----------------------------------------------------------
\r
3 ; MXIT.ASM - Initialization/termination functions
\r
4 ; Copyright (c) 1993,1994 by Alessandro Scotti
\r
6 ;-----------------------------------------------------------
\r
13 PUBLIC mx_VideoSegment
\r
14 PUBLIC mx_CodeSegment
\r
16 MX_TEXT SEGMENT USE16 PARA PUBLIC 'CODE'
\r
17 ASSUME cs:MX_TEXT, ds:NOTHING, es:NOTHING
\r
19 DB 'MODEX library - Copyright (c) 1992-1994 Alessandro Scotti'
\r
21 mx_VideoSegment DW 0A000h
\r
22 mx_CodeSegment DW SEG MX_TEXT
\r
24 ;-----------------------------------------------------------
\r
34 LOCAL Result:WORD, \
\r
36 CStoDSalias:WORD = AUTO_SIZE
\r
39 .push ds, si, es, di
\r
41 mov [Result], -1 ; Assume an error
\r
42 mov [VideoSeg], 0A000h ; Real mode video segment
\r
43 mov [CStoDSalias], cs ; Real mode data alias for CS
\r
45 ; Check if running in protected mode under DPMI
\r
49 jnz @@1 ; DPMI not found, continue in real mode
\r
51 ; Get a data alias for CS
\r
52 mov ax, 000Ah ; DMPI: create data alias
\r
55 jc @@Exit ; Exit if service failed
\r
56 mov [CStoDSalias], ax ; Save data alias for CS
\r
57 ; Get a protected-mode selector for the video segment
\r
59 mov bx, 0A000h ; Real mode segment of video
\r
60 int 31h ; DPMI: get segment selector
\r
61 jc @@Exit ; Exit if service failed
\r
62 mov [VideoSeg], ax ; Save protected mode video selector
\r
64 ; Initialize variables
\r
66 mov ds, [CStoDSalias]
\r
68 mov [mx_CodeSegment], ds
\r
70 mov [mx_VideoSegment], ax
\r
72 ; Don't bother with VGA check for now...
\r
82 ;-----------------------------------------------------------
\r