4 points · by gsivil · 15y ago · 8 comments
If I am not mistaken one of the important steps is to activate the so called video mode and not the text mode. Reading a bit about that I guess I have to access the memory buffer and modify individual chunks of memory. I cannot estimate how difficult this can be.
I know that there are libraries to let you do that on another window and of course to let you create images. Creating SVG pictures is rather trivial for example. I am interested to learn my self how to go in that level than to use a library.
I would be grateful to find resources for that and preferably in the following languages. Common Lisp > Python > C.
Feel free to ignore my question since it is driven by curiosity to hack and not from urgent need for productivity.
FWIW, this is how we used to do it in BASIC, C and MASM in the good ol' DOS days, back in the 80s; hope it can give you at least some conceptual confirmation + insight:
You wrote:
> activate the so called video mode and not the text mode
Spot on.
> access the memory buffer and modify individual chunks of memory
Spot on again. Unless I'm forgetting something, DOS used to reserve a chunk of RAM (that they called 'lower memory') as video RAM. We used to 'peek' and 'poke' bytes directly to this (at mem segment 0800:0000Hex or something). Of course, that was on CGA display adapters, and under DOS. With today's SVGA and whatnot + Ubuntu, a lot of these specifics would change but I'm afraid I won't be able to help you with all that - been a while (about 2 decades) since I could last indulge into that sort of hacking.
Well, best wishes from an ancient hacker - may you keep at it for as long as you wish to.
http://linux.die.net/man/3/vga_drawpixel
You should probably use a more advanced graphics library like the one provided by Gnome, but if you want to learn how to do it from scratch I suppose you need to start from a text mode Linux installation.
EDIT: take a look to http://code.google.com/p/lispbuilder/wiki/LispbuilderSDL
Your program can open up a window of its own and draw graphics in that.
Or you can do the low level thing on a different virtual console using Linux's framebuffer support (see the svgalib link octopus posted above) (as an aside, press Ctrl+Alt+F2, observe what happens, then Alt+F7 to return here).