Write ALP for DPMI
Write ALP for DPMI
.model small
.486P
disp macro msg
lea dx,msg
mov ah,09h
int 21h
endm
.data
msg1 db 10,13 ,"DPMI is present$"
msg2 db 10,13,"DPMI is not present$"
msg3 db 10,13,"memory allocated aready$"
msg4 db 10,13,"memory allocated manually$"
msg5 db 10,13,"GDT:$"
msg6 db 10,13,"LDT:$"
msg7 db 10,13,"MS:$"
msg8 db 10,13,"IDT:$"
msg9 db 10,13,"Task reg:$"
dpmi dw ?
gdtr dq ?
ldtr dw ?
ms dw ?
idtr dq ?
taskreg dw ?
.code
mov ax,@data ;initializtion of the data seg
mov ds,ax
mov ax,1687h ;check dpmi
int 2fh
or ax,ax ;present if it is zero
jz l1
disp msg2
jmp exit1
l1:disp msg1
mov dpmi[0],di
mov dpmi[2],es
mov ah,4ah
int 21h
cmp si,0000h
jne l2
disp msg3
jmp l3
l2:mov bx,si
mov ah,48h
int 21h
jc exit1
disp msg4
mov es,ax
l3:
call dword ptr dpmi
sgdt gdtr
sldt ldtr
sidt idtr
smsw ms
str taskreg
disp msg5
mov bx,word ptr gdtr[4]
call print
mov bx,word ptr gdtr[2]
call print
mov bx,word ptr gdtr[0]
call print
disp msg6
mov bx,ldtr
call print
disp msg7
mov bx,ms
call print
disp msg8
mov bx,word ptr idtr[4]
call print
mov bx,word ptr idtr[2]
call print
mov bx,word ptr idtr[0]
call print
disp msg9
mov bx,taskreg
call print
exit1:
mov ah,4ch
int 21h
print proc near
mov cx,0404h
up:rol bx,cl
mov dx,bx
and dx,000fh
cmp dx,0009h
jbe next
add dx,0007h
next:
add dx,0030h
mov ah,02h
int 21h
dec ch
jnz up
ret
print endp
end
OUTPUT
C:\tasm>tasm ass.asm
Turbo Assembler Version 2.0 Copyright (c) 1988, 1990 Borland International
Assembling file: ass.asm
Error messages: None
Warning messages: None
Passes: 1
Remaining memory: 474k
C:\tasm>tlink ass.obj
Turbo Link Version 3.0 Copyright (c) 1987, 1990 Borland International
C:\tasm>ass
DPMI is present
memory allocated manually
GDT:BA33C19003FF
LDT:0048
MS:003B
IDT:BA33C59007FF
Task reg:0028