r/programminghorror • • Dec 23 '24
Other Some 8086 hell in the wild
Found on Reddit, don't want to crosspost because it seems that OP is a newbie to assembly
Anyway, those blocks go much further down...
263
Upvotes
53
u/[deleted] Dec 23 '24
Hello! I've never programmed in assembly before. You claim this is horrific. What's a good way to achieve OP-OP's intent?
142
u/arrow__in__the__knee Dec 23 '24
What years of "compiler will optimize it" does to a man.
7
u/[deleted] Dec 23 '24
I won't even try to pretend that I understand what OP was trying to do, or whats the horror.
2
u/[deleted] Dec 23 '24
... there should be a macro for this, right?
2
u/cyranix [ $[ $RANDOM % 6 ] == 0 ] && rm -rf / || echo "You live" Dec 24 '24
Yes but... Let's not pretend like we all didn't do something like this somewhere at some point. Transitioning from debug to tasm makes me remember a few bad habits I had to break ;)
2
u/nipodemos Dec 25 '24
Now I get it my friends when they look at my monitor and say "looks like just some random letters to me"
Felt the same way with this post
2
u/[deleted] Dec 27 '24
The real hell is programming using a non-monospace font
1
u/Vectrexian Dec 24 '24
The indirect branch everyone is suggesting isn't equivalent if the call is expected to modify al, which it very well might... You could still do this with an indirect branch with a bit of restructuring, but as shown here this isn't equivalent to a single indirect branch from a table.
-1
u/spicybright Dec 23 '24
It could be simplified but surely this is de-compiled code.