4 ms·
First set mode 13h (320x200, 256 colors): asm mov ax,0013h int 10h end; ...then plot pixel with palette index c at coordinate (x,y) -- mem[] is a
by einr 4y ago
First set mode 13h (320x200, 256 colors):
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!
- carapace 4y agoOh my, the nostalgia... 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/Xiaolin_Wu%27s_line_algorithm https://en.wikipedia.org/wiki/Dos_debug https://en.wikipedia.org/wiki/Dos_debug https://www.jagregory.com/abrash-black-book/ https://www.jagregory.com/abrash-black-book/ https://en.wikipedia.org/wiki/IBM_PCjr https://en.wikipedia.org/wiki/IBM_PCjr
- daemin 4y agoYeah, I remember messing around with Mode-X and SVGA video modes, then writing code to plot lines, circles, Wu pixels, Anti-aliased lines and all that stuff. 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.
- lelanthran 4y agoI remember printing out something called (I think) Ralph Browns Interrupt List on the university line-printer, because I just learned how to embed asm into Turbo C and wanted graphics faster than BGI could do[1]. [1] The BGI library was insanely slow, because, IIRC, it used BIOS interrupts to draw. Could be wrong, I was very young then.
- Koshkin 4y agohttps://en.wikipedia.org/wiki/Ralf_Brown's_Interrupt_List https://en.wikipedia.org/wiki/Ralf_Brown's_Interrupt_List