Page 1 of 1
Problem with plotting pixels
Posted: Sat Jul 20, 2002 11:00 pm
by MattCarpenter
I am making a small 'kernel' in C. I compile the c file as a binary and it loads just fine with my pmode bootloader. When i try to write color data to 0xA0000 (which ppl tell me is the video memory) my computer re-boots! whats up with that?
RE:Problem with plotting pixels
Posted: Sat Jul 20, 2002 11:00 pm
by carbonBased
0xA0000 is video memory considering your current data segment descriptor has a base of 0, and a limit above 0xAFFFFF.
What's your code look like?
And are you sure pmode is setup correctly?
Jeff
RE:Problem with plotting pixels
Posted: Sat Jul 20, 2002 11:00 pm
by MattCarpenter
typedef unsigned char byte;
byte *VGA = (byte *)0xA0000;
short offset;
offset = 320*10 + 10;
video[offset]=7;
RE:Problem with plotting pixels
Posted: Sun Jul 21, 2002 11:00 pm
by RetainSoftware
I hope you've switched to a graphicsmode that has A0000 as a base address.
Otherwise if you've plain text then it will be B8000 and no pixels.
this code is wrong though
video[offset]=7 should be VGA[offset]=7
RE:Problem with plotting pixels
Posted: Sun Jul 21, 2002 11:00 pm
by MattCarpenter
how do you switch into a graphics mode?
RE:Problem with plotting pixels
Posted: Sun Jul 21, 2002 11:00 pm
by anton
The easyest way, is to switch to it while in real mode(mov ax,00xx; int 0x10, where xx is the mode:
bit 7 is set to clear the screen, others 0x12 that is 640x480 4 bit). It is a pain(you'l need to program
the graphical chip set like ega,vga or S3) to do it in pmode.