To use BGI or not to use BGI
Posted: Fri Nov 03, 2006 9:37 am
Hi,
well, I decided to "hardcode" my first GUI for OS without any tutorials - starting position
is a simple graphic mode 640x480 with 16 colors. Fine.
I've created a simple window with simple text. I've linked this little OS expletive to my OS myself. Worked - in Windows. Fine again.
But, I tried to execute GUI in QEMU. No such Windows/DOS kernel inside virtual machine; only PortixOS kernel (that's name of my OS
) and it won't work. It just displayed this:
BGI Error: Graphics not initialized (use InitGraph)
and I used correctly Initgraph and other stuff - that is because it worked under Win kernel. QEMU was set to use Cirrus Logic VGA card. Also, i tried to use Virtual PC - same result.
I used other architecture to prepare graphic mode:
- I used BINOBJ to convert EGAVGA.BGI to EGAVGA.OBJ.
- I followed the tutes how to link EGAVGA.OBJ directly to EXE - the kernel
of my OS.
- In Windows it worked perfectly.
I think that loading the BGI driver requires some memory operations - a memory handler. I dunno why BGI needs memory... But i DO have memory managment, simpler, but I think good:
Function MemRB (Offset : LongInt) : Byte; External;
Procedure MemWB (Offset : LongInt; Value : Byte); External;
Offset can be any number until 4GB memory limit (this is mem managment from A.Frounze - see below).
MemRB stands for "Memory Read Byte" and
MemWB stands for "Memory Write Byte".
I have also functions like MemRW ("Memory Read WORD") and so on.
Finally
- How can I reserve memory for BGI driver load?
Or the memory is not the main problem?
Thank you and big regards to all! (for very long reading...
)
A.Frounze's mem managment:
It creates under Protected Mode a 4GB segment, returns back to real mode and programmer can use all system memory - well, to 4GB.
OFF-TOPIC:
aaaargh, today's visit in surgery was very painful... i can feel it now as well...
A rip of your toe-nail with doctor tongs is very disgusting...
inflater
well, I decided to "hardcode" my first GUI for OS without any tutorials - starting position

I've created a simple window with simple text. I've linked this little OS expletive to my OS myself. Worked - in Windows. Fine again.
But, I tried to execute GUI in QEMU. No such Windows/DOS kernel inside virtual machine; only PortixOS kernel (that's name of my OS


BGI Error: Graphics not initialized (use InitGraph)
and I used correctly Initgraph and other stuff - that is because it worked under Win kernel. QEMU was set to use Cirrus Logic VGA card. Also, i tried to use Virtual PC - same result.
I used other architecture to prepare graphic mode:
- I used BINOBJ to convert EGAVGA.BGI to EGAVGA.OBJ.
- I followed the tutes how to link EGAVGA.OBJ directly to EXE - the kernel
of my OS.
- In Windows it worked perfectly.
I think that loading the BGI driver requires some memory operations - a memory handler. I dunno why BGI needs memory... But i DO have memory managment, simpler, but I think good:
Function MemRB (Offset : LongInt) : Byte; External;
Procedure MemWB (Offset : LongInt; Value : Byte); External;
Offset can be any number until 4GB memory limit (this is mem managment from A.Frounze - see below).
MemRB stands for "Memory Read Byte" and
MemWB stands for "Memory Write Byte".
I have also functions like MemRW ("Memory Read WORD") and so on.
Finally

Or the memory is not the main problem?
Thank you and big regards to all! (for very long reading...

A.Frounze's mem managment:
It creates under Protected Mode a 4GB segment, returns back to real mode and programmer can use all system memory - well, to 4GB.
OFF-TOPIC:
aaaargh, today's visit in surgery was very painful... i can feel it now as well...
A rip of your toe-nail with doctor tongs is very disgusting...
inflater