Page 1 of 1

[solved] VGA mode "13h" by registers

Posted: Sun Dec 09, 2007 3:34 am
by mystran
Mmmh.. so I thought I'd switch to some sort of graphics mode.. so I tried getting to the 320x200x256 VGA mode... but I'd love to do this without involving teh BIOS.. and for some reason I fail to get in there, even if I seem to do it all more or less the same as couple of other sources (svgalib, xorg..) so I guess I just fail to figure out something in there..

So far I've managed to get couple of interesting things happen in QEMU: 1280 pixels wide screen, which is normal 80x25 text mode but with each pixel twice as wide, and mm.. completely black screen.. that's the most promising thing.

I think I'm setting all the sequencer stuff, all CRTCs (copied from xorg then manually doublechecked for the best of my ability), the misc register, attributes 0x10,0x12,0x13,0x14 then graphics 5,6,7,8...

I'm also reprogramming my palette (and that works even without the mode switching) then clearing the screen (at 0xa0000) with white, so mm.. I should be getting something other than black.

Any suggestions where the problem might be?

[edit] Duh, also ment to say that if somebody has a straightforward listing of port-accesses for setting a given mode, please gimme... :D All the sources I can find have couple of levels of abstraction on top of the hardware access so they are kinda hard to read..

Posted: Sun Dec 09, 2007 6:24 am
by mystran
Ok, I just spent 'bout 12 hours banging my head to the wall, until I realized that if one has address/data IO register pairs, and one uses 16-bit accesses to write to them, then on little endian machines (like teh PC) you does not write:

out16_p(port, (address << 8 ) | data)

Instead, one writes:

out16_p(port, (data << 8 ) | address)

And when one realizes such a simple truth about process byte ordering with multi-byte IO access, then even the video graphics array starts behaving..

And I thought I knew how to program... :P

Posted: Mon Dec 10, 2007 6:41 am
by jal
mystran wrote:then on little endian machines (like teh PC) you does not write:

out16_p(port, (address << 8 ) | data)

Instead, one writes:

out16_p(port, (data << 8 ) | address)
Congratulations on this insight :). Now you must be banging your head for another 12 hours in realization :)). For me, this is one of the reasons I like little endian: if it's further into memory, it goes higher in the value :).


JAL