04-11-2005, 08:46 AM
Hi, im using 0.12b for dos and am porting across some old routines from QB for vesa and mouse. I know allegro covers these but its a bit of a bloater for very simple programs.
Anyway my problem occurs with VARSEG not being in FB. I think i've sussed the way to do what i want but it just wont work.
Heres a little example. this is just a very simple check to see if a VESA mode is available, and return the dimensions & bpp if necessary.
Thanks in advance for your help
Anyway my problem occurs with VARSEG not being in FB. I think i've sussed the way to do what i want but it just wont work.
Heres a little example. this is just a very simple check to see if a VESA mode is available, and return the dimensions & bpp if necessary.
Code:
#include "dos/go32.bi"
#include "dos/dpmi.bi"
#include "dos/sys/farptr.bi"
TYPE ModeInfoBlock
ModeAttributes AS INTEGER
WinAAttributes AS STRING * 1
WinBAttributes AS STRING * 1
WinGranularity AS INTEGER
WinSize AS INTEGER
WinASegment AS INTEGER
WinBSegment AS INTEGER
WinFuncPtr AS LONG
BytesPerScanLine AS INTEGER
XResolution AS INTEGER
YResolution AS INTEGER
XCharSize AS STRING * 1
YCharSize AS STRING * 1
NumberOfPlanes AS STRING * 1
BitsPerPixel AS STRING * 1
NumberOfBanks AS STRING * 1
MemoryModel AS STRING * 1
BankSize AS STRING * 1
NumberOfImagePages AS STRING * 1
Rsvd AS STRING * 1
RedMaskSize AS STRING * 1
RedFieldPosition AS STRING * 1
GreenMaskSize AS STRING * 1
GreenFieldPosition AS STRING * 1
BlueMaskSize AS STRING * 1
BlueFieldPosition AS STRING * 1
RsvdMaskSize AS STRING * 1
DirectColorModeInfo AS STRING * 1
Reserved AS STRING * 216
END TYPE
DIM regs As __dpmi_regs
DIM ModeInfo AS ModeInfoBlock
Regs.x.AX = &H4F01
Regs.x.CX = &H103
'Used to be this in QB
'Regs.ES = VARSEG(ModeInfo)
'Regs.DI = VARPTR(ModeInfo)
'Now Needs This??
'>> is a operator from C/C++ but i dont know what it is.
regs.x.di= __tb AND &H0F
regs.x.es=(__tb >> 4) AND &HFFFF
__dpmi_int &H10, @regs
'Should next line 3rd param be *modeinfo or @modeinfo ??
dosmemget(__tb, len(ModeInfoBlock), modeinfo)
IF (ModeInfo.ModeAttributes AND 1) = 0 THEN 'Bit 1 = 0 then mode not
PRINT "Error - screen mode not available." 'available.
ELSE
winGran = 64 \ ModeInfo.WinGranularity 'Window granularity adjusted.
xRes = ModeInfo.XResolution 'Get screen resolution.
yRes = ModeInfo.YResolution
bpp = ASC(ModeInfo.BitsPerPixel)
PRINT xRes,yRes,bpp
'if mode &H103 then output should be 800,600,8
END IF
Thanks in advance for your help