Rendering like it's 1996 – Baby's first pixel
marioslab.io
marioslab.io
That said, most of this seems to be Emscripten related kludge... seems kinda backward to use a portable language like C and compile to support one format (web).
asm
mov ax,0013h
int 10h
end;
...then plot pixel with palette index c at coordinate (x,y) -- mem[] is a built in array of bytes representing memory, 0xA000 is where the VGA framebuffer starts: mem[$a000:x+(y*320)] := c;
So yes, it's a oneliner, assuming you've already set the correct video mode!I remember pecking out Wu anti-aliased line drawing routines in asm in DOS Debug from out of the Black Book on a PCjr. Those were the days. (Just kidding. These are the days.)
https://en.wikipedia.org/wiki/Xiaolin_Wu%27s_line_algorithm
https://en.wikipedia.org/wiki/Dos_debug
Years later at different jobs I was able to use the accumulation method used in Bresenham's line drawing algorithm to do some neat integer based graph drawing and scaling.
[1] The BGI library was insanely slow, because, IIRC, it used BIOS interrupts to draw. Could be wrong, I was very young then.
https://gist.github.com/CoryBloyd/6725bb78323bb1157ff8d4175d...
Check out a modern library like raylib, it makes blasting out pixels on modern hardware easy: https://www.raylib.com/
Would obviously require some setup, but that functionality could come standard with the OS instead of requiring countless libraries.
Also half the article is about setting up a build system.
(modern GPUs gained performance at the cost of latency, but a lot of the complications are also just pointless over-engineering on the software side)
It didn't pay off though: the software people quickly had a flag in their driver, and just absent-mindedly flipped it whenever they came in and their screen was displaying upside down, then carried on working as if nothing untoward had happened.
Nowadays, I would not recommend that beginner attempt to build their own pixmap rendering program and even more definitely I wouldn't use C. The infinite black mire of "Open a Window" would absolutely kill whatever enthusiasm a beginner has.
There are lots of 2D game engines. Pick any one that works in the language you want and proceed henceforth.