VESA LFB under freepascal, help please ! - Programmers Heaven

Howdy, Stranger!

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


Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

VESA LFB under freepascal, help please !

LiamOKaneLiamOKane Posts: 1Member
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.