Problem with plotting pixels

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
MattCarpenter

Problem with plotting pixels

Post 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?
carbonBased

RE:Problem with plotting pixels

Post 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
MattCarpenter

RE:Problem with plotting pixels

Post by MattCarpenter »

typedef unsigned char byte;
byte *VGA = (byte *)0xA0000;
short offset;

offset = 320*10 + 10;
video[offset]=7;
RetainSoftware

RE:Problem with plotting pixels

Post 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
MattCarpenter

RE:Problem with plotting pixels

Post by MattCarpenter »

how do you switch into a graphics mode?
anton

RE:Problem with plotting pixels

Post 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.
Post Reply