delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2005/11/17/20:31:55

X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f
From: "Rod Pemberton" <donthave AT noreply DOT bit>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Get XMS version code
Date: Thu, 17 Nov 2005 20:21:06 -0500
Organization: Aioe.org NNTP Server
Lines: 75
Message-ID: <dlja9c$jk$1@domitilla.aioe.org>
References: <1132226267 DOT 238205 DOT 60500 AT g14g2000cwa DOT googlegroups DOT com>
NNTP-Posting-Host: pCFjXAYAthfOLF6YhIh1ZA.491.domitilla.aioe.org
X-Complaints-To: abuse AT aioe DOT org
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1441
X-Priority: 3
X-Newsreader: Microsoft Outlook Express 6.00.2800.1437
X-MSMail-Priority: Normal
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

<blk5743 AT yahoo DOT com DOT tw> wrote in message
news:1132226267 DOT 238205 DOT 60500 AT g14g2000cwa DOT googlegroups DOT com...
> hello,
> i modify a sample code from xms30 as below
> i will get a XMS API handle(XMSH[DWORD] declare in .cpp file)
> it will always fail when i run => call [_XMSH] <=
> i do not know how to modify this line.
> same code if define to 16 bits use( .com type)
> it can work well. but i can not combine the .com file with my djgpp
> project files.
>
> and i have another problem with segment registers
> i want to assign value to es register
> i use    * mov ax, 1 -> mov es,ax (assign 1 to es)
> or          mov ax, 1 -> push ax -> pop es
> both method will fail when the value assign to es

First problem, es is *NOT* a RM segment (16-bit code), es is a PM selector
(32-bit code).  You cannot change it's value...
Read my posted reply, on 11/16/05 7:34pm, to Roland Zitke "Obtaining the
physical address of a pointer using PMODE"

Second problem (in code below), DJGPP uses DPMI to access RM.  You cannot
call 'int 2f' directly from PM with DJGPP DPMI hosts.  The interrupt is not
reflected to RM like with WATCOM dos extenders/DPMI hosts.  You must use
'int 0x31, ax=0x0300' which is the DPMI call for 'Simulate Real Mode
Interrupt'.

Rod Pemberton

> [bits 32]
> [GLOBAL _GetXMSAddr__Fv]  ;function for other .cpp call
> [EXTERN _printf]
> [EXTERN _XMSH]   ;unsigned long, declare in another .cpp file
> msg  db "No XMS",0ah,0
> msg2 db "Get XMS",0ah,0
> msg3 db "Get XMS Ver Fail",0ah,0
> msg4 db "Get XMS Ver OK",0ah,0
> [section .text]
> _GetXMSAddr__Fv:
>         mov ax,4300h
>         int 2fh
>         cmp al,80h
>         jne NoXMS
>         jmp XMS
> NoXMS:
>         push dword msg
>         call _printf
>         mov ax, 0
>         jmp END
> XMS:
>         push dword msg2
>         call _printf
>         mov ax,4310h
>         int 2fh
>         mov [_XMSH], bx
>         mov [_XMSH+2], es
>
>         mov ah,00h
>         call [_XMSH]
>         cmp ax,0300h
>         jne NG
>         jmp OK
> NG:
>         push dword msg3
>         call _printf
>         jmp END
> OK:
>         push dword msg4
>         call _printf
> END:
>         ret
>


- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019