Graphics in ASM still a necessary thing?

Started by
24 comments, last by Nacho 22 years, 1 month ago
quote:Original post by Sorensen
I would like to know HOW does the api does to render it correctly on my screen.


It tells the hardware to do it.

But how? Where can I learn those principles?

Advertisement
quote:Original post by Ignacio Liverotti
Original post by Sorensen
I would like to know HOW does the api does to render it correctly on my screen.


It tells the hardware to do it.

But how? Where can I learn those principles?



Continue pursuing X86 assembly language.

If you''re doing things in DOS (which I assume you will be if you''re using Abrash''s book), start with Mode 0x13 which is a linear 8-bit 320x200 mode. Learn about the palette registers and do some stuff with them. None of this stuff will be particularly insightful to you (except perhaps the VGA palette registers, if you haven''t dealt with them before), but it''s a great place to start learning.

Then, if you have the time, it might not be such a bad idea to take a look at 320x240 or 320x200 ModeX (planar.) Nowadays you will only have to worry about linear modes but trying out a planar is an interesting exercise and will teach you how old games worked back in the Stone Age You''ll learn about how and why the VGA hardware uses planes (hint: 64KB segment limit in real mode) and you''ll get hands-on experience with VGA plane control registers. Just so you know, you don''t have to worry too much about HOW to get into ModeX (learning the functions of all of those registers used to set the mode will be rather pointless), but the rest is interesting stuff. Many consoles (prior to the 3D 32-bit systems) of yesteryear used planar graphics, and it is still an important concept to understand if you ever want to write code for or emulate older console and arcade systems.

I don''t know how Abrash teaches Mode X, as I skipped over that portion of the book, but I learned how to use it by looking at the tutorial included with it. Grab the Tweak package here: http://home.nvg.org/~rsc/programming.html

Anyway, if you get that far and want more, you can either keep working under DOS with VESA Video BIOS Extensions (a standardized set of SVGA BIOS calls for accessing high resolutions and color depths with linear frame buffers using bank switching or true linear frame buffer support in protected mode) or you can go back to Windows.

As to how APIs work for rendering 3D graphics, the best place to learn that would be to look at existing documentation for 3D hardware. This sort of hardware often works by having the CPU send commands to registers (or the card''s RAM) and the specified polygons end up getting drawn in a frame buffer which is displayed on the screen. Some console (PSX, Saturn, possible N64) and arcade (Hard Drivin'' in MAME) hardware is documented and that''s a great place to learn about this stuff since PC cards are fairly similar concept-wise.

There are probably articles and papers out there which deal with this as well (IEEE computer publications will sometimes have articles on this stuff.)

Have fun! You definitely are curious about this stuff and rather than accepting half-baked answers like "the API just _does_" or "it''s not important to know how", it''s a good thing that you are taking steps to educate yourself.


Bart
----Bart
how does the api tell the hardware how to do things? simple, it calls driver function stubs. this is why you need newer drivers to get the newer features of newer versions of dx. you should look at glide (3dfx only 3d api), the ddk for dx8 (at ms site), and of course you could try to find the white papers on the hardware and try to bypass the drivers.

though i think you are getting yourself confused about asm. its just another langauge like c, with the exception that its 1:1 with machine code (ie what you see is what you get). you should not waste time learning how an api does things with the video card unless you expect to write video card drivers for an api. there is nothing terribly interesting there gaming wise, and you wont learn much that will help you when you code games. learning how the card does things (ie write a software rasterizer) is more beneficial. also learning modex is pointless, directdraw will give you nearly the exact same type of access. also most of what you learn wont help you with newer games, but may be of interest to see how coders of the old days got past certain limits of the hardware/os.

i think you will confuse yourself by trying to understand the mess of the api interface to the drivers which interface the os and the video card. cant hurt to learn though if you have the time and pateince, but dont expect a much clearer outlook on how things work which will help you make the next great 3d engine.
Read Computer Graphics: Principles and Practice by Foley, van Dam, Feiner, et al. That book is the definitive work on the algorithms, data structures and procedures requisite to display 2- and 3-dimensional images on a computer screen. Also read other texts, texts on projection algebra, on matrix math - read texts on anything that interests you and may possibly answer any of your questions. Read about Fourier transforms if you''re into audio, and frequency modulation.

Read.

[ GDNet Start Here | GDNet Search Tool | GDNet FAQ | MS RTFM [MSDN] | SGI STL Docs | Google! ]
Thanks to Kylotan for the idea!
I agree with Oluseyi, read Computer Graphics principles and practice and a linear algebra math. THAT will teach you how 3d work, not asm . ASM is a mean not an end.
Thanks you guys for all the answers, I found ´em all very interesting! I´ll stick to 80x86 for a while, then I´ll move to Computer Graphics, probably with Foley´s book, which has been recommended to me several times. When I get a better grasp on that I´ll surely check those white papers from the card manufacturers. Thanks for the replies!

This topic is closed to new replies.

Advertisement