this post was submitted on 17 Mar 2026
51 points (96.4% liked)

Programmer Humor

30442 readers
2340 users here now

Welcome to Programmer Humor!

This is a place where you can post jokes, memes, humor, etc. related to programming!

For sharing awful code theres also Programming Horror.

Rules

founded 2 years ago
MODERATORS
 

An implementation of sudo for DOS, to run the given command with full privileges. It can be used to edit important system files, run disk partitioning tools, and so on!

you are viewing a single comment's thread
view the rest of the comments
[โ€“] umbraroze@slrpnk.net 2 points 19 hours ago (1 children)

I actually first thought that was weird and wasteful. Then I remembered that, uh, Commodore 64 often uses a similar thing. Basically, a lot of assembly and compiled languages just put the machine code into the BASIC memory, preceded by a stub BASIC program that's basically just "10 SYS addr" with that address pointing just past the end of the stub program itself. BASIC's LOAD command handles it just fine because program files don't have any header information besides load address. BASIC handles the loaded program just normally because the program has the end token, so as long as you don't modify the BASIC program, it'll be fine.

[โ€“] sjmulder@lemmy.sdf.org 1 points 19 hours ago

Luckily the .exe's MZ header is pretty small. But in this case it was necessary: when DOS loads a .com binary, it can't know how much memory it will need, so DOS just gives it all free memory. But then the program can't launch another, because all memory is in use. So that's why I had to add the MZ header which allows specifying the memory needs.