HEllo, I need some help (ASM source code). I've read the VBE 3 documentation and it told roughly (no source) how to obtain the Vesa protected mode entry point. It said you had to copy the bios code into a protected mode buffer and do a whole bunch of crap. I couldn't possibly know how to do all it said to do. Could somebody tell me where I could get the actual source for this (or an easier way to switch banks in protected mode without DPMI)
Thankyou
VESA Pmode Entry Point
RE:VESA Pmode Entry Point
So you have no issues stealing someone's vesa code, without even knowing what it does?
Anyway...
Do you at least know how to get a copy of the Vesa protected mode interface? Theoretically, you don't have to do anything else (I don't think..?) but you _should_ copy this memory into your pmode address space, and protect it somehow.
in a nutshell:
ax = 0x4f0a
bx = 0
int 0x10 ; in real mode!
if(ah) error
pmBuffer = alloc cx bytes in pmode
make memory (pmBuffer) executable/read-only (if need be)
copy real mode memory (es:di) to new buffer (cx bytes long, as above)
Done.
Now all pmode interface functions (setWindow, setDisplayStart, setPalette, and IOPrivInfo) can be called as offsets from your newly allocated pmode buffer...
ie: bankRoutine = (pmBuffer + pmBuffer->setWindow);
I'm not gonna bother with an assembly implementation... I don't have the time
This is not trivial. If you don't have a memory management system in place, you'll have to improvise on the malloc, etc part... I'd reccomend getting a memory management system in place first, actually. You'll also need methods of switching to and from real-mode or (better yet) a vm86 task.
Jeff
PS: the protected mode interface is part of VBE _2_
Anyway...
Do you at least know how to get a copy of the Vesa protected mode interface? Theoretically, you don't have to do anything else (I don't think..?) but you _should_ copy this memory into your pmode address space, and protect it somehow.
in a nutshell:
ax = 0x4f0a
bx = 0
int 0x10 ; in real mode!
if(ah) error
pmBuffer = alloc cx bytes in pmode
make memory (pmBuffer) executable/read-only (if need be)
copy real mode memory (es:di) to new buffer (cx bytes long, as above)
Done.
Now all pmode interface functions (setWindow, setDisplayStart, setPalette, and IOPrivInfo) can be called as offsets from your newly allocated pmode buffer...
ie: bankRoutine = (pmBuffer + pmBuffer->setWindow);
I'm not gonna bother with an assembly implementation... I don't have the time
This is not trivial. If you don't have a memory management system in place, you'll have to improvise on the malloc, etc part... I'd reccomend getting a memory management system in place first, actually. You'll also need methods of switching to and from real-mode or (better yet) a vm86 task.
Jeff
PS: the protected mode interface is part of VBE _2_
RE:VESA Pmode Entry Point
Thanks. THis psudo code makes much more sense than the vbe 3 documentation
One question though, how do I figgure out the offset of the vesa functions?
One question though, how do I figgure out the offset of the vesa functions?
RE:VESA Pmode Entry Point
That's actually exactly what's returned by the Vesa function 0x4f0a
Pointed to by es:di is a structure like this:
vbe4f0aBuffer:
dw setWindow ; These are all offsets,
dw setDisplayStart ; into this buffer, for
dw setPalette ; each of these pmode
dw IOPrivInfo ; routines
; actual code is located here
You'll notice, after the call, that cx will be _much_ larger than 4*2 (ie, 4 * sizeof(dw) ). That's because the call also returns the actual pmode code for the above four routines... they are, however, offsets _into_ this memory buffer... they aren't physical or linear addresses of any kind.
Therefore, in order to find the offset for any function, add its offset to the location of your vbe4f0aBuffer structure.
Hopefully that doesn't sound too loopy... I "may have" had "a few" beers
Jeff
Pointed to by es:di is a structure like this:
vbe4f0aBuffer:
dw setWindow ; These are all offsets,
dw setDisplayStart ; into this buffer, for
dw setPalette ; each of these pmode
dw IOPrivInfo ; routines
; actual code is located here
You'll notice, after the call, that cx will be _much_ larger than 4*2 (ie, 4 * sizeof(dw) ). That's because the call also returns the actual pmode code for the above four routines... they are, however, offsets _into_ this memory buffer... they aren't physical or linear addresses of any kind.
Therefore, in order to find the offset for any function, add its offset to the location of your vbe4f0aBuffer structure.
Hopefully that doesn't sound too loopy... I "may have" had "a few" beers
Jeff
RE:VESA Pmode Entry Point
So, in this line of code "bankRoutine = (pmBuffer + pmBuffer->setWindow);", would bankRoutine be a function (ie. bankRoutine(banknumber); )?
Thanks a lot for the help. I wonder why I havn't found anything on the internet that tells how to do this. This is pretty simple
Thanks a lot for the help. I wonder why I havn't found anything on the internet that tells how to do this. This is pretty simple
RE:VESA Pmode Entry Point
www.neuraldk.org/cgi-bin/document.pl?djgppGraphics
I wrote it six years ago, but it covers almost everything... although, from the DJGPP point of view.
bankRoutine is a function, but of type (void)(*)(void). In other words, it accepts no arguments, and returns nothing.
Banking is done, just like in real mode, but instead of "int 0x10, ax = 0x4f05", you call bankRoutine:
xor ebx, ebx
mov edx, [bankNum]
call [bankRoutine]
Jeff
I wrote it six years ago, but it covers almost everything... although, from the DJGPP point of view.
bankRoutine is a function, but of type (void)(*)(void). In other words, it accepts no arguments, and returns nothing.
Banking is done, just like in real mode, but instead of "int 0x10, ax = 0x4f05", you call bankRoutine:
xor ebx, ebx
mov edx, [bankNum]
call [bankRoutine]
Jeff