tags:

views:

352

answers:

5
+5  Q: 

BIOS Programming

Is it possible to call windows libraries that will live on the hard disk from a program that lives in the bios?

I'm trying to write a program that will be a BIOS option (after POST). I'd like the application to have a nice GUI instead of being text based (there are multiple reasons for this, localization being one of them).

My problem is that we are constrained by the size of the application that we can flash to the BIOS.

Is it possible using MASM32 to "Link" to the dll's on the hard disk so that we can use the Windows API's to develop the GUI?

Or is there an API that is availible to us to create the GUI that can be linked into the final executable? (60K size constraint on the final program executable)

Any help you can give would be greatly appreciated, thanks in advance.

+5  A: 

No, it isn't possible. A Windows application requires the Windows operating system to run on top of, so the BIOS must have booted the OS and finished running before a Windows GUI (or console app) can be used. Even to access the DLL files on the disk, you need a filesystem, which won't be available until the OS has booted.

However, In 60K, you should be able to fit quite a reasonable character-based GUI. I would take a look at how some of the linux bootloaders do this.

anon
A: 

There are no BIOS implementations which support this. But in theory it's possible, but keep in mind that first you should develop entire OS :)

Vladimir
I'm not trying to create an OS, I'm trying to write a module that will run in the BIOS. I can guarantee that windows 7 will on the computer however this code needs to run in BIOS before the OS loads.
+6  A: 

It is possible. All you'd have to do is:

  • set the processor into protected mode and map memory as expected (flat model)
  • develop a filesystem driver and load that
  • support all the possible video cards, mice, monitors, keyboards, etc. including potentially legacy hardware
  • set up the execution environment so that all external references of the requested DLL are present, including (for Windows) KERNEL32, GDI, etc.

There's a lot to this, and it's not easy. However, an example which comes close is MenuetOS, an impressively compact environment. But it completely is born from a complete rethinking of how to implement a GUI environment.


I've written BIOS code which simulates a GUI interface. The video card is kept in text mode, the font is made nicer looking, the text cell separators are turned off, and the mouse is recognized. With simple animation, the whole thing did fit into 60 KiB or so.

wallyk
Like this answer :D, however how do you fit that in 60k ? :D
Hassan Syed
Could you display images or unicode characters like chinese?
I've got a killer awesome code compression algorithm to do it. But I haven't quite worked out the decompressor. :-)
wallyk
@user274217: not pictures, not in that kind of memory footprint. Graphics were limited to line drawing character squares and what could be done with various colored text cells.
wallyk
So the memory issue is the constraint not the technology? So if I could up the memory usage would it be possible to create dialog resources in windows and embed the windows libraries into the final executable? Maybe use the includelib directives in MASM32?
Certainly the memory constraint presents a serious challenge; the more memory available the more that is possible. However, even doing this in—say—512 KiB is many man years of effort. As the memory limit decreases, the development effort climbs exponentially.
wallyk
Thanks, I'm abandoning his thread as it doesn't look like it is possible in the time we have permitted. Opened a different post at http://stackoverflow.com/questions/2272000/displaying-graphics-in-bios for an alternative option
To sum up, if you reimplement half of Windows operating system, you can do that;)
el.pescado
A: 

You might be interested in looking at the source code of XOSL- an old boot manager that had a nice windowed GUI.

Kramii
A: 

I'm not sure if the request is actually possible. (Keeping in mind the context of the question)

For this to work, you would have to initialise the entire Microsoft windows environment in order to use the API functions to draw a GUI.

Out of curiosity, what are you doing in this BIOS program?

kaylnn