VESA LFB under freepascal, help please !

there is my code under freepascal... what's wrong to use LFB ?

uses dos, go32;

TVBEInfo = packed record
Signature: array[0..3] of char;
Version: word;
OemStringPtr: pointer;
Capabilities: longint;
VideoModePtr: longint;
TotalMemory: word;
OemSoftwareRev: word;
OemVendorNamePtr: longint;
OemProductNamePtr: longint;
OemProductRevPtr: longint;
Reserved: array[0..221] of byte;
OemData: array[0..255] of byte;
end ;

{ Mode info record required for GetModeInfo }

TModeInfo = packed record
ModeAttributes: word;
WinAAttributes: byte;
WinBAttributes: byte;
WinGranularity: word;
WinSize: word;
WinASegment: word;
WinBSegment: word;
WinFuncPtr: longint;
BytesPerScanLine: word;
XResolution: word;
YResolution: word;
XCharSize: byte;
YCharSize: byte;
NumberOfPlanes: byte;
BitsPerPixel: byte;
NumberOfBanks: byte;
MemoryModel: byte;
BankSize: byte;
NumberOfImagePages: byte;
Reserved: byte;
RedMaskSize: byte;
RedFieldPosition: byte;
GreenMaskSize: byte;
GreenFieldPosition: byte;
BlueMaskSize: byte;
BlueFieldPosition: byte;
RsvdMaskSize: byte;
RsvdFieldPosition: byte;
DirectColorModeInfo: byte;
PhysBasePtr: longint;
OffScreenMemOffset: longint;
OffScreenMemSize: word;
Reserved2: array[0..205] of byte;
end ;

VBEInfo : TVBEInfo;
modeinfo : tmodeinfo;
regs : trealregs;
vbDosBuffer : longint;
LFBPtr : longint;
t : word;
memorysize : longint;
SelectAddr : word;

realintr($10, regs);

vbDosBuffer := Global_Dos_Alloc(1024);

DosMemPut(vbDosBuffer shr 16, vbDosBuffer and 65535, VBEInfo, 4); := vbDosBuffer shr 16;
Regs.di := vbDosBuffer and 65535; := $4F00;
realIntr($10, Regs);
DosmemGet(vbDosBuffer shr 16, vbDosBuffer and 65535, VBEInfo, 512); := $4F01; := vbDosBuffer shr 16;
Regs.di := vbDosBuffer and 65535; := $4101;
realintr($10, Regs);
if = $4f then
DosMemGet(vbDosBuffer shr 16, vbDosBuffer and 65535, ModeInfo, 256)
else writeln('error !');

// LFBPtr:=get_linear_addr(modeinfo.winasegment, vbeinfo.totalmemory * 65536);
// t:=15;
// allocate_ldt_descriptor(LFBPtr);
// seg_fillword(LFBPtr, 0, 1, t);

memorysize:=vbeinfo.totalmemory * 65536;
LFBPtr:=Get_Linear_Addr(modeinfo.physbaseptr, memorysize);
Set_Segment_Base_Address(SelectAddr, LFBPtr);
Set_Segment_Limit(SelectAddr, MemorySize);

{ t:=15;
seg_fillword(SelectAddr, 0, 1, t); }

{ SelectAddr:=Allocate_LDT_Descriptors(1);
Set_Segment_Base_Address(SelectorAddress, LinearAddress);
Set_Segment_Limit(SelectorAddress, MemorySize); }

realintr($10, regs);



Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!