-
Notifications
You must be signed in to change notification settings - Fork 47
/
dpmic.asm
54 lines (38 loc) · 852 Bytes
/
dpmic.asm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
FORMAT MZ
HEAP 0
segment DATA16
USE16
; main
segment CODE16
USE16
error:
mov ax,0x4C00
int 0x21
modesw dd 0
start16:
; A raw (not DOS32A) DPMI client
mov ax,1687h ; get address of DPMI host's
int 2fh
or ax,ax ; exit if no DPMI host
jnz error
mov word [modesw],di
mov word [modesw+2],es
or si,si ; check private data area size
jz .l1 ; jump if no private data area
mov bx,si ; allocate DPMI private area
mov ah,48h ; allocate memory
int 21h ; transfer to DOS
jc error ; jump, allocation failed
mov es,ax ; let ES=segment of data area
.l1:
xchg bx,bx
mov ax,0 ; bit 0=0 indicates 16-bit app
call [modesw] ; switch to protected mode
xchg bx,bx
jc error ; jump if mode switch failed
; else we're in prot. mode now
nop
mov ax,0x4C00
int 0x21
SEGMENT ENDS
entry CODE16:start16