flat assembler
Message board for the users of flat assembler.

Index > OS Construction > Accessing Video Card RAM?

Goto page Previous  1, 2, 3
Author
Thread Post new topic Reply to topic
Raedwulf



Joined: 13 Jul 2005
Posts: 375
Location: United Kingdom
Raedwulf
f0dder wrote:
2000 and XP are very similar yes (NT5.0 and NT5.1), there's kernel changes on XP though, and some changes in userland win32 API as well... but I think drivers written for one should basically run out of the box for the other.

The ISSUE, however, is not 2000 vs. XP, it's 32 vs 64 bits. You can't just use drivers for one mode in the other.

Also, XP64 is actually based on 64bit win2k3 server code, not 32bit XP code... but again, 2k3 server is still NT5.x afaik.


Yes of course Smile I meant that the logical structure of the drivers were similar, I know 64-bit OS needs 64-bit drivers and 32-bit OS needs 32-bit drivers Smile.

_________________
Raedwulf
Post 08 Jan 2008, 08:01
View user's profile Send private message MSN Messenger Reply with quote
Madis731



Joined: 25 Sep 2003
Posts: 2145
Location: Estonia
Madis731
rhyno_dagreat wrote:

Madis, we're trying to figure out a way around reverse engineering graphics drivers. Wink

Whoops Embarassed

DOS386 wrote:

Quote:
1. method: int 10h - vesa call - returns dword of framebuffer memory
; ---
2. method: PCI scan - this method is able to handle qword address of framebuffer


Maybe ... but still very insufficient Crying or Very sad Writing into the LFB won't have any (useful) effect without setting the mode before ... and there is no universal method to do except VESA Sad

I don't understand this ^o) If you have a set mode (I mean ANY mode) then shouldn't writing to the LFB emit some light from the screen from some point? If you don't know, its hard to know where the screen line ends, but if a default resolution is known (somehow?!) you will code keeping this in mind and thus no need to set a new mode.

Maybe I didn't get it clearly.

_________________
My updated idol Very Happy http://www.agner.org/optimize/
Post 08 Jan 2008, 08:52
View user's profile Send private message Visit poster's website Yahoo Messenger MSN Messenger Reply with quote
DOS386



Joined: 08 Dec 2006
Posts: 1903
DOS386
Quote:
If you have a set mode (I mean ANY mode) then shouldn't writing to the LFB emit some light from the screen from some point?


YES Question

Quote:
but if a default resolution is known (somehow?!) you will code keeping this in mind and thus no need to set a new mode.


IIRC the "default" mode is 80x25 text Laughing

Quote:
Maybe I didn't get it clearly.


Not at all Sad

_________________
Bug Nr.: 12345

Title: Hello World program compiles to 100 KB !!!

Status: Closed: NOT a Bug
Post 09 Jan 2008, 01:07
View user's profile Send private message Reply with quote
Madis731



Joined: 25 Sep 2003
Posts: 2145
Location: Estonia
Madis731
Right - I'm thinking too OS-level, where a default mode is graphical Very HappyVery HappyVery Happy

I will shut up - and read more about VESA Wink
Post 09 Jan 2008, 07:11
View user's profile Send private message Visit poster's website Yahoo Messenger MSN Messenger Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7106
Location: Slovakia
vid
Madis: Setting mode is pretty much a problem, using direct video RAM access. So yes, you need some card-specific code or VESA anyway.
Post 09 Jan 2008, 07:15
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
Feryno



Joined: 23 Mar 2005
Posts: 449
Location: Czech republic, Slovak republic
Feryno
the sample for win64 has a lot of necessary bullshits, so try to read src/sys/a08.asm try to search string 80000000h somewhere in the middle of a08.asm
if you have win64 you can directly test it using 08_test.bat. Under Vista x64 do steps described in *.txt file.
If you are developping hobby OS, use int 10h VESA call to set video mode and another VESA call to obtain LFB (this int10h call is also required for knowing whether video mode uses 24 bits for 1 pixel or 32-bit for pixel etc). If your OS doesn't use paging, you can do it in the way described by DOS386. I hope you will developp your OS further so after enabling paging you need to map LFB somewhere.
When graphic cards with 2 GB memory come to common market I suppose the int 10h method will be insuffient to obtain LFB (the top of of LFB address can't fit into 4 GB limit) but PCI scan method will work fine.

P.S. sorry I left 32 bit world years ago, the sample is pure 64 bit. For 32-bit fans it is really easier to use int 10h VESA calls.
P.S.2
the code is optimized for the smallest possible size, to minimum of instructions used and to avoid conditional branches, so you need to "decode" some parts a lot (e.g. lea eax,[rcx+rdx*4+10h] instead of mov eax,ecx shl edx,2 add eax,edx add eax,10h etc.)


Description: win64 sample, read src/sys/a08.asm, the core is somewhere in the middle of file - try to find in/out instructions
Download
Filename: PCI_LFB.ZIP
Filesize: 49.86 KB
Downloaded: 90 Time(s)

Post 09 Jan 2008, 08:42
View user's profile Send private message Visit poster's website ICQ Number Reply with quote
Madis731



Joined: 25 Sep 2003
Posts: 2145
Location: Estonia
Madis731
What does "native" do in "format PE64 native 5.02"? Haven't heard about it.
Post 09 Jan 2008, 09:46
View user's profile Send private message Visit poster's website Yahoo Messenger MSN Messenger Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7106
Location: Slovakia
vid
it's "native subsystem", google Wink

I think all drivers must be flagged as native
Post 09 Jan 2008, 10:28
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
Madis731



Joined: 25 Sep 2003
Posts: 2145
Location: Estonia
Madis731
Hmm, okay - I wonder why it isn't silent then (i.e. on by default)...

Anyways, the driver worked fine after changing the hard-coded C:\Windows to something more like %WINDIR%. It answered to the eternal question with a number: 00000000D0000000h Very Happy

The question being - LFB?
Post 09 Jan 2008, 10:45
View user's profile Send private message Visit poster's website Yahoo Messenger MSN Messenger Reply with quote
rhyno_dagreat



Joined: 31 Jul 2006
Posts: 487
Location: Maryland, Unol Daleithiau
rhyno_dagreat
Okay... So I want to reverse engineer my graphics drivers... where do I begin?
Post 09 Jan 2008, 17:58
View user's profile Send private message Reply with quote
rhyno_dagreat



Joined: 31 Jul 2006
Posts: 487
Location: Maryland, Unol Daleithiau
rhyno_dagreat
With all this talk about VESA, it just struck me: Couldn't we access the IVT, particularly interrupt 10h, then figure out the address of that, then from there figure out the address of the VESA functions?
Post 09 Jan 2008, 20:42
View user's profile Send private message Reply with quote
DOS386



Joined: 08 Dec 2006
Posts: 1903
DOS386
Quote:
Couldn't we access the IVT, particularly interrupt 10h, then figure out the address of that, then from there figure out the address of the VESA functions?


YES Idea This way you will get the VESA functionality via ports, __maybe__ fix 1 or 2 minor bugs, but not the "advanced" stuff beyond VESA (more modes, bigger LFB (sometimes VESA reports less RAM than in fact exists), 2D, 3D, 4D, 5D, ... "acceleration", ...)
Post 09 Jan 2008, 22:35
View user's profile Send private message Reply with quote
Feryno



Joined: 23 Mar 2005
Posts: 449
Location: Czech republic, Slovak republic
Feryno
rhyno_dagreat, you'll spend a lot of time...
look, it is really easy to use 2-3 int 10h calls in real mode and then load your OS which won't depend on any int 10h call anymore
this is about 1/2 year old crap from me, I developped it further, but this sample does everything necessary, you can freely extract what do you need and copy->paste into your project
it switches into 64-bit, so download qemu-64 or write into floppy and boot under 64-bit CPU (there is really lack of such configs todays - 64-bit CPU and floppy drive... you can also make bootable CD with emulation of floppy etc.)
Madis731, thank you for the report, I'll improve the *.bat file. Nice to read that it worked. 'native' means you want to compile driver (*.sys) or native application (special exe, I posted some samples about year ago in the fasm board, really funny)
http://board.flatassembler.net/topic.php?t=4941


Description: samples of necessary int 10h calls in real mode, switching into 64-bit and using framebuffer without int 10h calls (no PCI scan method to obtain LFB)
Download
Filename: K0RMAN05.ZIP
Filesize: 23.67 KB
Downloaded: 113 Time(s)

Post 10 Jan 2008, 07:34
View user's profile Send private message Visit poster's website ICQ Number Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  
Goto page Previous  1, 2, 3

< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2019, Tomasz Grysztar.

Powered by rwasa.