www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/07/15/19:16:19

From: tmurez AT planete DOT net
Newsgroups: alt.lang.asm,comp.lang.asm.x86,comp.os.msdos.djgpp
Subject: Need help : Problem building a vesa lib with nasm&djgpp
Date: 15 Jul 1998 23:02:23 GMT
Organization: Planete.net, France
Lines: 266
Approved: <johnfine AT erols DOT com>
Message-ID: <6ojcdv$dg9$1@winter.news.erols.com>
NNTP-Posting-Host: 207-172-240-181.s54.as3.bsd.erols.com
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Hi,
(excuse my mistakes i m french)
I'm used to build programs with BC++ and his inline assembly. I wanted to 
use DMPI so i got DJGPP and NASM. I've written the following routine. My 
problems and what i noticed with fsdb (djgpp debugger) are written in the 
routine.
(I'v added at the end of this message my Rhide's bug report)
*************************************************************************
vbelib.asm (nasm -f coff vbelib.asm):

[BITS 32]

[GLOBAL _VBE2Detect]

[SECTION .text]

;Function VBE2Detect();
;out : 0 if error or vesa 2 not available, 1 if vesa 2 or greater 
;							available

_VBE2Detect:
        pushad
        mov AX, 0100h ;DPMI Allocate DOS Memory Block int 31h fct 100h
        mov BX, 32    ;32 paragraphs equ to 512 bytes (vesa info header)
        int 31h
        jnc .MemoireAllouee		;jump if memory allocated
        popad				;else pop registers and return 0
        xor eax, eax
        ret

        .MemoireAllouee:
                mov [DOSMEM_RMSEG], AX  ;save real mode segment
                mov [DOSMEM_SELECTOR], DX ;save mem selector
                mov ecx, eax	;ecx will be linear address
                and ecx, 0FFFFh	;clear high 16bits
                shl ecx, 4		;seg*16
                mov [DOSMEM_LINADDR], ECX ;save linear address

                mov dword [ecx+VbeInfoBlock+VbeSignature], 'VBE2'
				;asking for VBE 2.0 Info
                push ds
                pop es          ;es=ds to prevent GPF
                mov EDI, RMREGS ;edi=offset RMREGS
                mov dword [RM_EAX], 04F00h ;VESA Fct 00h
                mov dword [RM_EDI], 0	;offset dosmem=0
                mov word [RM_ES], AX	;segment returned from int31h
                mov AX, 0300h           ;DPMI Simulate Real ModeInterrupt
                mov BX, 0010h		;real mode int 10h
                xor CX, CX			;cx=0
                int 31h
                jnc .Interrupt31Succes ;jump if success
		;else free dos mem and return 0
                mov AX, 0101h   ;DPMI Free DOS Memory Block
                mov DX, [DOSMEM_SELECTOR]
                int 31h
                popad
                xor EAX, EAX
                ret

        .Interrupt31Succes:
                mov eax, [RM_EAX]
                cmp dword AX, 04Fh		;Check if Vesa fct call succeed
                je .InterruptVbeSucces	;jump if success
			;else free dos mem and return 0
                mov AX, 0101h
                mov DX, [DOSMEM_SELECTOR]
                int 31h
                popad
                xor eax, eax
                ret


;using fsdb i can tell everything works fine until here.
;I think the problem is the offset, seg or linear address i 
;use. It seems that the Dos memory i have allocated earlier is not filled 
;with Vesa Info during int 10h. I've tried to use random values for real 
;mode offset and segment and vesa returned success...I'd like to know if 
;there's something more to do to access to dos memory like mapping or 
;something else, if i have to copy something between stacks (param CX)
;I think the problem is that vesa writes somewhere in memory and that i 
;don't look for data at the right place...MAYDAY !!

        .InterruptVbeSucces:
                mov ecx, [DOSMEM_LINADDR]
                cmp dword [ecx+VbeInfoBlock+VbeSignature], 'ASEV'
                je .VESADetecte

                mov AX, 0101h
                mov DX, [DOSMEM_SELECTOR]
                int 31h
                popad
                xor eax, eax
                ret

        .VESADetecte:
                cmp word[ecx+VbeInfoBlock+VbeVersion], 0200h
                jge .VBE2

                mov AX, 0101h
                mov DX, [DOSMEM_SELECTOR]
                int 31h
                popad
                xor eax, eax
                ret

        .VBE2:
                mov AX, 0101h
                mov DX, [DOSMEM_SELECTOR]
                int 31h
                popad
                xor eax, eax
                inc eax
                ret


[SECTION .data]

        DOSMEM_RMSEG            dw      0      
        DOSMEM_SELECTOR         dw      0      
        DOSMEM_LINADDR          dd      0      

        struc VbeInfoBlock
                VbeSignature        resb 4     ; VBE Signature
                VbeVersion          resw 1     ; VBE Version
                OemStringPtr        resd 1     ; Pointer to OEM String
                Capabilities        resb 4;Capabilities of graphics cont.
                VideoModePtr        resd 1   ; Pointer to Video Mode List
                TotalMemory         resw 1 ; Number of 64kb memory blocks
        	     ; Added for VBE 2.0
                OemSoftwareRev      resw 1 ; VBE implementation Software 
revision
                OemVendorNamePtr    resd 1         ; Pointer to Vendor 
Name String
                OemProductNamePtr   resd 1         ; Pointer to Product 
Name String
                OemProductRevPtr    resd 1         ; Pointer to Product 
Revision String
                Reserved            resb 222       ; Reserved for VBE 
implementation
						    ; scratch area
                OemData             resb 256       ; Data Area for OEM 
Strings
        endstruc

        RMREGS:
                RM_EDI          dd      0
                RM_ESI          dd      0
                RM_EBP          dd      0
                RM_Reserved     dd      0
                RM_EBX          dd      0
                RM_EDX          dd      0
                RM_ECX          dd      0
                RM_EAX          dd      0
                RM_Flags        dw      0
                RM_ES           dw      0
                RM_DS           dw      0
                RM_FS           dw      0
                RM_GS           dw      0
                RM_IP           dw      0
                RM_CS           dw      0
                RM_SP           dw      0
                RM_SS           dw      0


************************************************************************
This is a bug report for RHIDE Version 1.4 (Sep 30 1997 23:06:59)
I am running MS-DOS 7.10 (Windows 95)

Important environment variables:
PATH=C:\PROGRA~1\UTILIT~1\NORTON~1;C:\PROGRA~1\BUREAU~1\OFFICE\OFFICE;C:\
WINDOWS;C:\WINDOWS\COMMAND;C:\PROGRA~1\COMPRE~1\;C:\DRIVERS\4DOS\;c:\prog
ra~1\progra~1\djgpp2\bin;
DJGPP=c:\progra~1\progra~1\djgpp2\djgpp.env
LFN=y
INFOPATH=c:/progra~1/progra~1/djgpp2/info;c:/progra~1/progra~1/djgpp2/gnu
/emacs/info;c:/progra~1/progra~1/djgpp2/info;c:/progra~1/progra~1/djgpp2/
gnu/emacs/info
LOCALEDIR=
LANGUAGE=
SHELL=
COMSPEC=C:\DRIVERS\4DOS\4DOS.COM
DJSYSFLAGS=

Here is the output from a sample compilation and link for C
executing: 
echo "int main(){return 0;}" | redir -eo gcc -Xlinker -v -Wa,-v -v -o 
/dev/null -x c -
Reading specs from c:/progra~1/progra~1/djgpp2/lib/specs
gcc version 2.8.1
 c:/progra~1/progra~1/djgpp2/lib/gcc-lib/djgpp\2.81\cpp.exe -lang-c -v -
undef -D__GNUC__=2 -D__GNUC_MINOR__=8 -Dunix -Di386 -DGO32 -DMSDOS -
DDJGPP=2 -DDJGPP_MINOR=1 -D__unix__ -D__i386__ -D__GO32__ -D__MSDOS__ -
D__DJGPP__=2 -D__DJGPP_MINOR__=1 -D__unix -D__i386 -D__GO32 -D__MSDOS -
D__DJGPP=2 -D__DJGPP_MINOR=1 - 
c:/progra~1/progra~1/djgpp2/tmp/RHaaaaaa\ccaywrjh
GNU CPP version 2.8.1 (80386, BSD syntax)
#include "..." search starts here:
#include <...> search starts here:
 c:/progra~1/progra~1/djgpp2/include
 c:/progra~1/progra~1/djgpp2/lib/gcc-lib/djgpp/2.81/include
 c:/progra~1/progra~1/djgpp2/include
End of search list.
 c:/progra~1/progra~1/djgpp2/lib/gcc-lib/djgpp\2.81\cc1.exe 
c:/progra~1/progra~1/djgpp2/tmp/RHaaaaaa\ccaywrjh -quiet -dumpbase -.c -
version -o c:/progra~1/progra~1/djgpp2/tmp/RHaaaaaa\ccbywrjh
GNU C version 2.8.1 (djgpp) compiled by GNU C version 2.8.1.
 c:/progra~1/progra~1/djgpp2/bin/as.exe -v -o 
c:/progra~1/progra~1/djgpp2/tmp/RHaaaaaa\cccywrjh 
c:/progra~1/progra~1/djgpp2/tmp/RHaaaaaa\ccbywrjh
GNU assembler version 2.8.1 (i386-pc-msdosdjgpp)
 c:/progra~1/progra~1/djgpp2/bin/ld.exe -o /dev/null 
c:/progra~1/progra~1/djgpp2/lib/crt0.o -Lc:/progra~1/progra~1/djgpp2/lib 
-Lc:/progra~1/progra~1/djgpp2/lib/gcc-lib/djgpp\2.81 -
Lc:/progra~1/progra~1/djgpp2/bin -Lc:/progra~1/progra~1/djgpp2/lib -v 
c:/progra~1/progra~1/djgpp2/tmp/RHaaaaaa\cccywrjh -Tdjgpp.djl -lgcc -lc -
lgcc
GNU ld version 2.8.1 (with BFD 2.8.1)
 c:/progra~1/progra~1/djgpp2/bin/stubify.exe -v /dev/null
Warning: input file is not COFF or stubbed COFF
.exe: No such file or directory (ENOENT)
stubify for djgpp V2.X executables, Copyright (C) 1995 DJ Delorie

End of the sample

Here is the output from a sample compilation and link for C++
executing: 
echo "int main(){return 0;}" | redir -eo gcc -Xlinker -v -Wa,-v -v -o 
/dev/null -x c++ -
Reading specs from c:/progra~1/progra~1/djgpp2/lib/specs
gcc version 2.8.1
 c:/progra~1/progra~1/djgpp2/lib/gcc-lib/djgpp\2.81\cpp.exe -lang-c++ -v 
-undef -D__GNUC__=2 -D__GNUG__=2 -D__cplusplus -D__GNUC_MINOR__=8 -Dunix 
-Di386 -DGO32 -DMSDOS -DDJGPP=2 -DDJGPP_MINOR=1 -D__unix__ -D__i386__ -
D__GO32__ -D__MSDOS__ -D__DJGPP__=2 -D__DJGPP_MINOR__=1 -D__unix -D__i386 
-D__GO32 -D__MSDOS -D__DJGPP=2 -D__DJGPP_MINOR=1 -D__EXCEPTIONS - 
c:/progra~1/progra~1/djgpp2/tmp/RHaaaaaa\ccaqdtjh
GNU CPP version 2.8.1 (80386, BSD syntax)
#include "..." search starts here:
#include <...> search starts here:
 c:/progra~1/progra~1/djgpp2/lang/cxx
 c:/progra~1/progra~1/djgpp2/include
 c:/progra~1/progra~1/djgpp2/lang/cxx
 c:/progra~1/progra~1/djgpp2/lib/gcc-lib/djgpp/2.81/include
 c:/progra~1/progra~1/djgpp2/include
End of search list.
 c:/progra~1/progra~1/djgpp2/lib/gcc-lib/djgpp\2.81\cc1plus.exe 
c:/progra~1/progra~1/djgpp2/tmp/RHaaaaaa\ccaqdtjh -quiet -dumpbase -.cc -
version -o c:/progra~1/progra~1/djgpp2/tmp/RHaaaaaa\ccbqdtjh
GNU C++ version 2.8.1 (djgpp) compiled by GNU C version 2.8.1.
 c:/progra~1/progra~1/djgpp2/bin/as.exe -v -o 
c:/progra~1/progra~1/djgpp2/tmp/RHaaaaaa\cccqdtjh 
c:/progra~1/progra~1/djgpp2/tmp/RHaaaaaa\ccbqdtjh
GNU assembler version 2.8.1 (i386-pc-msdosdjgpp)
 c:/progra~1/progra~1/djgpp2/bin/ld.exe -o /dev/null 
c:/progra~1/progra~1/djgpp2/lib/crt0.o -Lc:/progra~1/progra~1/djgpp2/lib 
-Lc:/progra~1/progra~1/djgpp2/lib/gcc-lib/djgpp\2.81 -
Lc:/progra~1/progra~1/djgpp2/bin -Lc:/progra~1/progra~1/djgpp2/lib -v 
c:/progra~1/progra~1/djgpp2/tmp/RHaaaaaa\cccqdtjh -Tdjgpp.djl -lgcc -lc -
lgcc
GNU ld version 2.8.1 (with BFD 2.8.1)
 c:/progra~1/progra~1/djgpp2/bin/stubify.exe -v /dev/null
Warning: input file is not COFF or stubbed COFF
.exe: No such file or directory (ENOENT)
stubify for djgpp V2.X executables, Copyright (C) 1995 DJ Delorie

End of the sample

- Raw text -


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