by chmod775 · 5y ago · 0 comments
This is a good reminder that us software devs generally live in bubbles, not really thinking about or (sometimes intentionally) ignoring things that are not immediately relevant to our work.
The author appears to mostly work in game development, specifically shading, 3D, and engine development. Generally you think very little about writing secure code in those fields.
You can actually see him going down the "low-level rabbit-hole" if have a look at his posts: http://kylehalladay.com/archive.html
That sounds incredibly patronising. Most software in any field is insecure. It is not unique to games development. SQL injection and buffer overruns is still a thing. Even today.
[0] http://www.linusakesson.net/scene/parallelogram/index.php
There is no memory protection and no software abstractions. You display graphics on the screen by writing directly to video memory.
Programming for the C64 made me have innumerable lightbulb moments and significantly changed my perspective on what a computer really is.
You can have similar experience with a little more power by writing code in mode 13h for dos. Want to light a pixel with specific color? Change byte of memory at A000 + y*320+x :).
You have 256 colors, every pixel is a byte, and you have another place in memory where it says what each color number maps to in rgb values. So you can do palette animations trivially.
There is no easier way to program graphic IMHO.
You can use any language - my favorite was Turbo Pascal 7 (but the compiler has a bug that breaks on cpus with over 200 MHz clock - you need to download turbo pascal and a patch that fixes this issue for example https://www.trsek.com/download/T7tplfix.zip ).
You might enjoy https://github.com/kragen/bubbleos/blob/master/yeso.
/* Munching squares, generalized to TrueColor. */
#include <yeso.h>
int main()
{
ywin w = yw_open("munching squares", yp_p(1024, 1024), "");
for (int t = 0;; t++) {
ypic fb = yw_frame(w);
for (int y = 0; y < fb.size.y; y++) {
ypix *p = yp_line(fb, y);
for (int x = 0; x < fb.size.x; x++) p[x] = (t & 1023) - ((x ^ y) & 1023);
}
yw_flip(w);
}
}
I think that, in terms of accessibility, these 14 lines of C compare favorably to the 15 instructions (and one assembler directive) in the 31-byte mode-X demo Klappquadrat, for example. Yeso also has Lua and Python bindings, which are somewhat incomplete. I haven't written Pascal bindings for it yet, but feel free.On the other hand, that won't give you the same kind of satori experience as the bare-metal C64 experience, because Yeso is running on top of some arbitrary stack of software you don't understand, and the C64 VIC (or VGA mode 13h, at least if you're using a real VGA) is really just circuits. Using Yeso won't stop you from feeling that what's behind the library calls is magic.
I also remember that I couldn't make graphic programs do anything, I only played with SID and commodore-ascii graphic. Somehow all the programs from the manual with sprites didn't do anything when I typed them in. I had no internet back then and it was a big deal for me. So big I remember it to this day :)
I remember I thought they misprinted the pokev adress so I did a for loop that put the things they wanted me to poke into any adress in a for loop, but that didn't worked either. I still have that C64 and I WILL at some point find out what was the problem :)
That's a private repository?