Wednesday, June 10, 2026

Are we teaching programming wrong?

A YouTuber's channels ("Dave's Garage" and "Dave's Attic") frequently leads me down a bit of tech nostalgia as he's very much into retro tech but in a much more accessible way than most Youtubers do. He also responds on video to some comments on his videos, and has even responded to mine a couple of times, so I do like his stuff.

Anyway, one of his videos sparked a discussion about how people learned programming in the past and how constraints helped people learn better. And my comment reminded me, I still remember the actual hex dump of my first ever assembly/machine language program, 30 years later!

The story behind it is weird: in 1996, my dad brought us our first home computer. It was a 286 with 1mb RAM and a 40MB hard disk. It was loaded with MS-DOS 6.22, Windows 3.0 and a few random things (Dbase 4 and WordStar 7 as I was learning those in school) and Microsoft Qbasic.

At some point, dad had picked up a "MS-DOS 5.0 User guide" and "MS-DOS 3.0 Programmer's guide" from a "raddiwala" (ie a scrap shop/recycling shop). Both books were wildly outdated in 1996/1997 but as I felt like I had already exhausted the possibilities of what could be done using QBasic, I lapped up and assimilated the knowledge contained in both those books very eagerly. My only problem: I had no way to put them into practical use! I lacked access to an assembler, and before the days of the internet, I didn't even have access to a way to get one! However, I figured a workaround, a way to make a start.

MS-DOS 5.0 onwards contained a tool "debug.exe" (the Microsoft debugger) which allowed debugging of running executables. Buried in all of its functionality, it had the capability to overwrite code manually using x86 assembly. So I loaded a random executable in the debugger, and overwrote the code with my own program. Once done, I used the hex dump functionality to take the binary representation of what I had just written - and wrote it literally on pen and paper. Yep, this was back in the days before copy-paste and screenshots!

I then wrote a QBasic program to create a binary file, which I could then execute and test. And it worked!

The whole process was so long and tedious that the hex dump of that program is etched into my own non-binary memory. It's all of 2 bytes, which makes it easier to remember, but still, here it is (in Hexadecimal):

CD19

It's so weird that I actually remember it so literally, that I had to double check that I indeed remember it correctly - and I do. I remember it so literally that I had to actually convert 19 in hex to decimal (ie 25) to know what to input into the online assembly tool!

This is the sort of effort that definitely etches things into your memory. I don't remember any other two bytes I've "composed" myself. So yeah - my first ever assembly program, and it was written without a proper compiler because I didn't have one.

Thankfully my cousin Ted was into programming and he had MASM and TASM, and I managed to get them on floppy disks (he had a Pentium-100 running Windows 95, absolutely blazing for the time and for me!). And so my second assembly program was written on a real compiler.

ps: if anyone is curious, the assembly for my first program is "int 25", the execution of which triggers a software interrupt that's handled by the IBM BIOS as the first step of the boot process - basically, initiate a software reboot! it needs to be in a ".com" file as ".exe" files need a header which I obviously didn't know how to write!

No comments:

popular posts