-
graphics optimization
Is there a way to do a DMA transfer from RAM to video memory in real-mode DOS programs using graphics mode 13H (a.k.a. 0x13 a.k.a. 19)?
I am trying to optimize my graphics library so I can start programming games, and I'd like to be able to use a buffer in RAM that I can refresh to the screen with a superfast DMA transfer. I'm mostly just looking for port numbers/memory addresses and protocol for programming the video controller to use a DMA transfer, so the language doesn't matter, but in case anybody's curious I'm using a combination of Borland C++ 5.0 and Assembly. Thanks.
-
i wouldn't think so. also you could gain a great amount of speed using dirty rectangles with your back buffers.
-
Video cards are all pretty unique in that sort of thing unfortunately. Might try looking at a lib that already does what you want and figure out how they did it. Allegro for DOS is open source and giftware, might have what you're looking for. http://www.talula.demon.co.uk/allegro/
-
If you're trying to optimize your graphics library, this _isn't_ the place to start. Moving data from RAM to video ram is handled by hardware. The video RAM is memory mapped to RAM in the computer. when data is stuffed into the RAM memory with the same map, the GPU scans that memory and copies the data into the VRAM.
No, if you wrote the libraries, the speed increases are going to occur based on the logic of the code written, not by trying to beat hardware (which you won't succeed at).
enjoy.
-
You will need that DMA later for sound programming. The best way to refresh the screen is by using a pointer and the flipping the pointer. You can also use a back buffer - but in assembly or inline asm you should be able to blit to 320x200x256 in milliseconds. I can blit to 320x200x32 bit color in DJGPP in the blink of an eye, w/o using assembly. To blit the screen just do a memcpy or code your own in assembly using 32-bit opcodes.
Using the DMA to blit the screen would be a huge pain in the neck and I'm not even sure if you can do it.