flat assembler
Message board for the users of flat assembler.

Index > DOS > MEMID 0.5 -- detect DPMI, VCPI, EMS, XMS and their versions

Author
Thread Post new topic Reply to topic
rugxulo



Joined: 09 Aug 2005
Posts: 2341
Location: Usono (aka, USA)
rugxulo
EDIT: This current version (0.5) does not have the older bug mentioned later in the thread.

Code:
; MEMID5.ASM -- rugxulo AT gmail DOT com
; public domain ("nenies proprajxo")
;
; Check out FASM:  http://board.flatassembler.net

org 100h

BREAK equ int3
;SPLIT equ aam

macro SPLIT { 
      mov cl,4 
      shl ax,cl 
      shr al,cl 
}

macro UPPERCASE b { 
      cmp b,'a' 
      jb @f 
      cmp b,'z' 
      ja @f 
      and b,0DFh 
@@: 
}

macro ERR a { 
      cmp byte [opt],a 
      jnz @f 
      mov word [error],bp 
@@: 
}

macro HELP { 
      mov dx,help_msg 
      call puts 
      mov byte [error],255 
}

CR=13
LF=10
TAB=9

Opts:
        mov si,80h
        mov cl,byte[si]
        xor ch,ch
        jcxz is286
@@:
        inc si
        cmp byte [si],20h
        loope @b
@@:
        cmp byte [si],'/'
        jnz @f
        inc si
        jmp @b
@@:
        UPPERCASE byte [si]
        push ax
        mov al,byte [si]
        mov byte [opt],al
        pop ax
        cmp byte [si],'?'
        jnz @f
        mov byte [si],'H'
@@:
        cmp byte [si],'H'
        jnz @f
        HELP
        jmp Fino
@@:
is286:
        mov ax,sp
        cmp ax,sp
        jnz VCPI
PMODE:
        smsw ax
        test al,1
        jz DPMI
        mov dx,pmode_msg
        call puts
        mov bp,1
        ERR 'P'
DPMI:
        mov ax,1687h
        int 2Fh
        test ax,ax
        jnz VCPI
        mov bp,dx
        cmp bp,100h
        jnz @f
        mov bp,100
@@:
        push dx dx
        mov dx,dpmi_msg
        call puts
        pop ax
        xor ah,ah
        aam
        xchg ah,al
        pop bx
        xor bl,bl
        or ax,bx
        call ver
        ERR 'D'
VCPI:
        mov ax,3567h
        int 21h
        mov ax,es
        test ax,ax
        jnz @f
        test bx,bx
        jz EMM386
@@:
        mov ax,0DE00h
        int 67h
        test ax,ax
        jnz EMM386
        mov dx,vcpi_msg
        call puts
        xchg ax,bx
        call adjust
        call ver
        ERR 'V'
EMM386:
        mov ax,3D00h
        mov dx,emm386_id
        int 21h
        jc XMS
        xchg ax,bx
        mov ax,4400h
        int 21h
        jc XMS
        test dx,80h
        jz XMS
EMS:
        mov ah,40h
        int 67h
        test ah,ah
        jnz XMS
        mov dx,emm386_msg
        call puts
        mov ah,46h
        int 67h
        SPLIT
        call adjust
        call ver
        ERR 'E'
XMS:
        mov ax,4300h
        int 2Fh
        cmp al,80h
        jnz crlf
        mov dx,xms_msg
        call puts
        mov ax,4310h
        int 2Fh
        mov word [xms_addr],bx
        mov word [xms_addr+2],es
        xor ah,ah
        call dword [xms_addr]
        call adjust
        call ver
        ERR 'X'
crlf:
        mov dl,13
        call putc
        mov dl,10
        call puts2
Fino:
        mov ah,4Ch
        mov al,byte [error]
        int 21h
puts:
        mov ah,9
puts2:
        int 21h
        ret
putc:
        mov ah,2
        jmp puts2
ver:
        xchg dx,ax
        or dx,'00'
        xchg dh,dl
        call putc
        mov dl,'.'
        call putc
        xchg dh,dl
        call putc
        mov dl,' '
        call putc
        ret
adjust:
        push ax
        aad
        mov bp,ax
        pop ax
        ret

error dw 4C00h
help_msg db CR,LF,'MEMID 0.5 -- returns errorlevel',CR,LF,CR,LF
         db '/h',TAB,'help',  TAB,'255',     CR,LF
         db '/p',TAB,'Pmode?',TAB,'0  | 1',  CR,LF
         db '/d',TAB,'DPMI?', TAB,'90 | 100',CR,LF
         db '/v',TAB,'VCPI?', TAB,'10 | ??', CR,LF
         db '/e',TAB,'EMS?',  TAB,'32 | 40', CR,LF
         db '/x',TAB,'XMS?',  TAB,'20 | 30', CR,LF,'$'

pmode_msg db 'PMODE $'
dpmi_msg db 'DPMI $'
vcpi_msg db 'VCPI $'
emm386_id db 'EMMXXXX0',0
emm386_msg db 'EMS $'
xms_msg db 'XMS $'

xms_addr rb 4
opt rb 1

; EOF
    


DOSBox 0.70 wrote:

EMS 4.0 XMS 3.0


WinXP wrote:

DPMI 0.9 XMS 2.0


Get the API specs for these interfaces (in plain text) from here:

http://ftp.lanet.lv/ftp/mirror/x2ftp/msdos/programming/specs/00index.html


Description: memid5.com, memid5.fas (FASM src), memid5.nas (NASM or YASM src), memid5.oct (Octasm src)
Download
Filename: MEMID5.ZIP
Filesize: 4.42 KB
Downloaded: 133 Time(s)



Last edited by rugxulo on 23 Apr 2008, 20:28; edited 2 times in total
Post 17 Jul 2007, 19:27
View user's profile Send private message Visit poster's website Reply with quote
Picnic



Joined: 05 May 2007
Posts: 1288
Location: behind the arc
Picnic
It's nice rugxulo, thanks Very Happy
Post 18 Jul 2007, 14:29
View user's profile Send private message Reply with quote
DOS386



Joined: 08 Dec 2006
Posts: 1901
DOS386
DOS wrote:

Quote:


Voila ^^^ Laughing

I had a similar thing on other forum ... before it all got kicked Sad
Post 22 Jul 2007, 22:40
View user's profile Send private message Reply with quote
MHajduk



Joined: 30 Mar 2006
Posts: 6034
Location: Poland
MHajduk
rugxulo wrote:
; public domain, free for any use ("nenies proprajxo")
rugxulo, are you Esperantist? Very Happy
Post 23 Jul 2007, 08:03
View user's profile Send private message Visit poster's website Reply with quote
Japheth



Joined: 26 Oct 2004
Posts: 151
Japheth
Good! There is a small inconsistency in there, however: if EMS is OFF (no EMMXXXX0 device exists). VCPI can still be enabled.
Post 23 Jul 2007, 14:07
View user's profile Send private message Visit poster's website Reply with quote
rugxulo



Joined: 09 Aug 2005
Posts: 2341
Location: Usono (aka, USA)
rugxulo
Japheth wrote:
Good! There is a small inconsistency in there, however: if EMS is OFF (no EMMXXXX0 device exists). VCPI can still be enabled.


I assume you know what you're talking about (you obviouly know much more than me), but I have never seen such a situation (and wouldn't know how to setup such). If you know how, please tell me. (The VCPI.DOC says VCPI is a superset of an EMS driver, so I assumed it was always available if EMS was found.)

Code:
(according to VCPI.DOC) ...

          lea dx,emm_name      ; open EMM device, read-only
          mov ax,3D00h
          int 21h
          jc short no_vcpi     ; branch if error
    


With XMS already loaded, jemm386 load novcpi reports "XMS 3.0 EMS 4.0" while a normal jemm386 load reports "VCPI 1.0 XMS 3.0 EMS 4.0".
Post 25 Jul 2007, 03:05
View user's profile Send private message Visit poster's website Reply with quote
rugxulo



Joined: 09 Aug 2005
Posts: 2341
Location: Usono (aka, USA)
rugxulo
MHajduk wrote:
rugxulo wrote:
; public domain, free for any use ("nenies proprajxo")
rugxulo, are you Esperantist? Very Happy


Jes (malgraux mia malofta uzo). Cxu ankaux vi scipovas gxin cxu nur vi konas gxin pro la pola doktoro kiu kreis gxin?
Post 25 Jul 2007, 03:10
View user's profile Send private message Visit poster's website Reply with quote
MHajduk



Joined: 30 Mar 2006
Posts: 6034
Location: Poland
MHajduk
ruĝulo
rugxulo wrote:
Jes (malgraux mia malofta uzo). Cxu ankaux vi scipovas gxin cxu nur vi konas gxin pro la pola doktoro kiu kreis gxin?
Unfortunately, I don't speak/write Esperanto, but I can recognize it (in writing) because of its special features (this "overloading" by "x" and "j" letters for example). Very Happy This language, created by Polish doctor Ludwik Zamenhof, is based on some Romanic languages, but different from each of them. Smile

BTW. ruĝulo, are you red-haired (ginger)? Wink
Post 25 Jul 2007, 07:54
View user's profile Send private message Visit poster's website Reply with quote
rugxulo



Joined: 09 Aug 2005
Posts: 2341
Location: Usono (aka, USA)
rugxulo
MHajduk wrote:

BTW. ruĝulo, are you red-haired (ginger)? Wink


No, but Snoopimeanie is. Laughing
Post 26 Jul 2007, 21:32
View user's profile Send private message Visit poster's website Reply with quote
Japheth



Joined: 26 Oct 2004
Posts: 151
Japheth
rugxulo wrote:

... but I have never seen such a situation (and wouldn't know how to setup such). If you know how, please tell me. (The VCPI.DOC says VCPI is a superset of an EMS driver, so I assumed it was always available if EMS was found.)

It's very simple, just use the NOEMS option. It this option would also disable VCPI, no protected-mode program can be executed then.
Post 27 Jul 2007, 05:59
View user's profile Send private message Visit poster's website Reply with quote
rugxulo



Joined: 09 Aug 2005
Posts: 2341
Location: Usono (aka, USA)
rugxulo
Updated / hopefully fixed this. (Seems like VCPI.DOC is wrong, oh well.)

Japheth, I now see that this is similar to your own \TEST\DPMI.EXE from HXRT.ZIP (but yours provides more info, of course). Hopefully mine is also correct now. Smile
Post 31 Jul 2007, 02:02
View user's profile Send private message Visit poster's website Reply with quote
DOS386



Joined: 08 Dec 2006
Posts: 1901
DOS386
Japheth wrote:

> There is a small inconsistency in there, however: if EMS is OFF (no EMMXXXX0 device exists

But it "works" for me (some JEMM versions at least) Laughing

Nevertheless, fixed and improved:

Download now : http://board.flatassembler.net/download.php?id=3252 (2 KiB)
Post 04 Sep 2007, 20:40
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2020, Tomasz Grysztar. Also on YouTube, Twitter.

Website powered by rwasa.