port_out(0x3c4,0xf02);
I SO WANT TO EQUATE 0x3C4 TO THE VGA SEQUENCER INDEX REGISTER BUT I CAN'T
okay I've fixed OSDEV:
https://wiki.osdev.org/Game_port
They had the introduction of the gameport listed as "the PCjr" (it's from 1981, the PCjr came out in 1984... and didn't even have this gameport connector!) but more importantly, they had the order of the joystick axises wrong.
god. Duke Nukem 1 has so much copy-pasted code.
Like, there's a ton of hint dialog boxes like "You need the key to open this door!" or "you get more points if you catch the balloon"
you'd think they'd just have ShowMessage() and pass it a different string, but nope. it's a different function.
interesting. there's 12 hint-variables which are used to make sure you don't get hinted for something you've used before.
One of them is still maintained, but not used. So there must have been another hintable thing that got dropped
like, it has a function that loops through all 16 color indices and sets them to black. it takes one parameters, which tells it how long to wait between each color is set, so it'll fade slowly to black, instead of being instant.
there's also an identical function that does the same, but sets it to white, instead.
the only difference between the "draw proton"/"draw duke" functions is what base address they draw from.
YOU CAN PASS ADDRESSES TO FUNCTIONS, TODD
Nope! it's known, it's just slightly mis-documented and tricky to pull off.
If you press the fire button (not alt!) and release F6 on the main menu, after launching the game with "dn1 asp", you can play the demo level
@foone There are languages/formalisms where you can only pass one parameter to a function.
Maybe they were working in a language where you can't pass *any* parameters to a function?
I'm sure there's some mathematician that's managed it. Somewhere.

@poeschel @foone At this point, I'm talking out of my arse (I'm not really an x86 person), but it's duplicating a significant amount of code to avoid passing a single (possibly-)far pointer where it could avoid the duplication at the cost of passing one far pointer? Seems like a significant mis-optimisation on the part of the compiler.
Maybe a segment change is massively more expensive than I think it is, but I hope it isn't that bad.
@foone If it was fading each index (slowly changing to the target, rather than just switching one palette entry at a time), then I could understand making it two functions, as it probably makes the code a bit simpler.
Of course, if it's just:
for(int i=0; i<16; i++) { palette[i] = 0; }
then separate functions are less attractive.
Who said old code was more efficient? 
@foone IUP. They kept beating us over the head with that in all the C++ courses.
Their curriculum is decidedly behind the times, or was when I went there. They cancelled their Java classes after one semester, but two semestrs of COBOL are required to graduate with a comp.sci degree.
Or were when I went there. It's been almost 25 years, to be honest.
@goofpunk not exactly. it passes some kind of number that's an index to a list of strings.
so... almost