Post AwfVHAFL71YTWDyPpI by foone@digipres.club
 (DIR) More posts by foone@digipres.club
 (DIR) Post #AwfEdgNccf1MKU00yO by foone@digipres.club
       2025-07-30T16:11:20Z
       
       0 likes, 0 repeats
       
       I'm hacking on Solar Winds (DOS, 1993) again. I really don't understand what happened to it during development.There's like, two copies of the game script? one in the EXE, and one in BH_CONV.dat.It only seems to use the BH_CONV.DAT one, though
       
 (DIR) Post #AwfEp6QG8ZoOHgg7NY by foone@digipres.club
       2025-07-30T16:13:25Z
       
       1 likes, 0 repeats
       
       this game is about 1.1 megabytes, so maybe they just never bothered trying to save space, since it already nicely fit on a 1 HD floppy (5.25" or 3.5") or two DD 5.25" floppies?
       
 (DIR) Post #AwfEteh0fClnjIgTdg by foone@digipres.club
       2025-07-30T16:14:17Z
       
       0 likes, 0 repeats
       
       still, why waste 30kb?
       
 (DIR) Post #AwfFDV28HoVjZ01iKW by foone@digipres.club
       2025-07-30T16:17:51Z
       
       1 likes, 0 repeats
       
       some of these strings are double delimited: both $ and NUL. Smells like a assembly macro for defining $-strings
       
 (DIR) Post #AwfFKAiGEgbgZFugpk by foone@digipres.club
       2025-07-30T16:18:55Z
       
       0 likes, 0 repeats
       
       anyway I am not 100% sure the two game scripts are identical. might be interesting to find out
       
 (DIR) Post #AwfFasCAKyVU3irgdk by foone@digipres.club
       2025-07-30T16:21:47Z
       
       0 likes, 0 repeats
       
       @0 it just crashes with a file-missing error if the dat file is missing, it doesn't use the one in the exe
       
 (DIR) Post #AwfKY4608ONLs0ShHM by foone@digipres.club
       2025-07-30T17:17:35Z
       
       0 likes, 0 repeats
       
       the other interesting thing about solar winds that I discovered a while back: it doesn't really support a "new game" option, it just starts by loading a hidden save file: BH_START.DAT is actually a save game, and sets up the initial state of the game
       
 (DIR) Post #AwfNbGcALVrhQZj0wi by foone@digipres.club
       2025-07-30T17:51:41Z
       
       0 likes, 0 repeats
       
       here's another bit of evidence that this program was written in assembly:it basically never uses function parameters. The couple times it does, it's using reserved registers like SI/DI.
       
 (DIR) Post #AwfNe0d6EZcgihTA0G by foone@digipres.club
       2025-07-30T17:51:49Z
       
       0 likes, 0 repeats
       
       very un-c-like behavior
       
 (DIR) Post #AwfOUU0IGc3GseL7Hk by foone@digipres.club
       2025-07-30T18:01:43Z
       
       0 likes, 0 repeats
       
       this may be the first game I've seen that reads the palette out of the VGA registers.normally games just set it, ignoring what's in it before!
       
 (DIR) Post #AwfQ8GNASxdm8rZTzE by foone@digipres.club
       2025-07-30T18:19:48Z
       
       0 likes, 0 repeats
       
       @TomGwozdz yeah I'm planning to compare against silverball /epic pinball to see if he reused any code
       
 (DIR) Post #AwfQdgIa7jRJWkPKHw by foone@digipres.club
       2025-07-30T18:25:48Z
       
       0 likes, 0 repeats
       
       all the DAT filenames are prefixed with BH_hypothesis: the original title for Solar Winds was "Black Hole"
       
 (DIR) Post #AwfS9hSjQs34MCzEsS by foone@digipres.club
       2025-07-30T18:42:50Z
       
       0 likes, 0 repeats
       
       I think this game doesn't have a random number generatorinstead, every time it needs random numbers, it calls DOS's Get System Time API and then uses the centiseconds as the random number
       
 (DIR) Post #AwfT9zUMVk5MDdS4bA by tauon@possum.city
       2025-07-30T18:47:12.728Z
       
       0 likes, 0 repeats
       
       @foone@digipres.club so the game would be deterministic if your rtc were broken?
       
 (DIR) Post #AwfTA0HHZrDWfML8qm by foone@digipres.club
       2025-07-30T18:54:00Z
       
       0 likes, 0 repeats
       
       @tauon no, because DOS maintains the time while it's running.
       
 (DIR) Post #AwfTDUkqinDA3bpnvM by foone@digipres.club
       2025-07-30T18:54:16Z
       
       0 likes, 0 repeats
       
       @dan_ballard just general hacking because it's there. I don't think it has any copy protection
       
 (DIR) Post #AwfTZaRkEvxY55QtLk by foone@digipres.club
       2025-07-30T18:58:19Z
       
       0 likes, 0 repeats
       
       @pence I actually already did a speedrun for solar winds! the end goal of the game is always accessible from the beginning, you're just not normally supposed to be able to go there until way later, and not supposed to know you need to get there until the very end. but if you just fly there directly, you'll win by doing basically nothing, it just takes an hour and 14 minutes:https://www.youtube.com/watch?v=rg5QdpE16hI
       
 (DIR) Post #AwfU6NfskMF01egO8W by foone@digipres.club
       2025-07-30T19:04:37Z
       
       0 likes, 0 repeats
       
       okay I found the code that determines which sprite to use for NPC ships. I hardcoded it to value 0 and now every ship is the unused ship0 (as seen on TCRF)
       
 (DIR) Post #AwfUN1ZWB2LYOldsUi by foone@digipres.club
       2025-07-30T19:07:06Z
       
       0 likes, 0 repeats
       
       *(wchar_t *)(u_00000000000000000000000000000000_1019_b9a0 + 100) = L'\0';what's with this address, ghidra? do you think I'm running a 144bit double-segmented architecture?
       
 (DIR) Post #AwfVHAFL71YTWDyPpI by foone@digipres.club
       2025-07-30T19:17:49Z
       
       0 likes, 0 repeats
       
       oh hey hardcoding the ship to type 0 causes some WEIRD problems when you restart a game.
       
 (DIR) Post #AwfVX9mEcphehDzBBY by darkling@mstdn.social
       2025-07-30T19:20:34Z
       
       0 likes, 0 repeats
       
       @foone It knows you well.
       
 (DIR) Post #AwfViNoQmZ0jPaMlEm by gsuberland@chaos.social
       2025-07-30T19:22:12Z
       
       0 likes, 0 repeats
       
       @foone somewhere out there there's a DSP chip that fits this exact description
       
 (DIR) Post #AwfVl8Fb65ki14NrBQ by gewt@san-junipero.gimme-sympathy.org
       2025-07-30T19:22:15Z
       
       0 likes, 0 repeats
       
       @foone you might not be but i am
       
 (DIR) Post #AwfVutrRS6VMHdk7fM by foone@digipres.club
       2025-07-30T19:24:52Z
       
       0 likes, 0 repeats
       
       @Mendie_Taoma I don't believe so. other than the music, this game was solely by James Schmalz, who didn't work on Tyrian
       
 (DIR) Post #AwfWHUgZDhFurcQiiu by foone@digipres.club
       2025-07-30T19:28:59Z
       
       0 likes, 0 repeats
       
       @gewt unsurprised
       
 (DIR) Post #AwfXJgrqzx89BAJvsW by foone@digipres.club
       2025-07-30T19:40:31Z
       
       0 likes, 0 repeats
       
       guh. I'm staring confused at this palette fade, wondering why it's only lowering the colors by 0x40.VGA uses a 6-bit color palette, foone. the max value for any color channel is 0x3F!
       
 (DIR) Post #AwfYSJO9lIIgv96Y2y by foone@digipres.club
       2025-07-30T19:53:27Z
       
       0 likes, 0 repeats
       
       okay I figured out where the fade-out and fade-in routines are and disabled them both. mostly.fade-in I had to leave in place or the palette would never be set, but I did disable vsync so it finishes nigh-instantly
       
 (DIR) Post #AwfYZflIyblSKzRTRA by foone@digipres.club
       2025-07-30T19:54:44Z
       
       0 likes, 0 repeats
       
       anyway decoding this has given me a new perspective on a childhood bug: I played this game when it was new, but it sometimes crashed at the end of cutscenes.I've always figured that was a PIC timer problem of some kind, but now I'm thinking it might be because of the weird way they read back the VGA palette. Maybe that was crashing, because of my packard bell's VGA card?
       
 (DIR) Post #AwfYdr2cywVwTiXStc by foone@digipres.club
       2025-07-30T19:55:31Z
       
       0 likes, 0 repeats
       
       it could also be the vsync. maybe it was waiting for a screen refresh signal that never came?
       
 (DIR) Post #AwfZbMPXzfmqr4dMHY by tekhedd@byteheaven.net
       2025-07-30T20:06:12Z
       
       0 likes, 0 repeats
       
       @foone I can see why most games wouldn't read the palette. Yes, you've saved a few bytes, but you can't depend on how long it will take to read. Or even if it will succeed or give correct values. :D
       
 (DIR) Post #AwfbiK7v5KRrhopw92 by dgelessus@mastodon.social
       2025-07-30T20:29:49Z
       
       0 likes, 0 repeats
       
       @foone this gave me a cursed idea: `double`-segmented architecture.Addresses are double-precision floating point numbers. The exponent is the segment address. The higher the address is, the bigger the segment size can be - but once the addresses get too high, they no longer support byte-granular access.
       
 (DIR) Post #AwfcRCY06yKJEKR32G by foone@digipres.club
       2025-07-30T20:37:59Z
       
       0 likes, 0 repeats
       
       @dgelessus AHHHHHH
       
 (DIR) Post #Awfcm50nK8ENwLrJZI by foone@digipres.club
       2025-07-30T20:41:48Z
       
       0 likes, 0 repeats
       
       well I don't understand how to use the text drawing routine properly, but I sure as fuck know how to use it improperly.
       
 (DIR) Post #AwfcpZiXcLZG2ZzIkC by foone@digipres.club
       2025-07-30T20:42:14Z
       
       0 likes, 0 repeats
       
       It seems to be embedding coordinates into a 16bit integer but not in a way that makes any fucking sense to me
       
 (DIR) Post #AwfdVsSyIeecLrsP8i by Andrew@mnstdn.monster
       2025-07-30T20:49:06Z
       
       0 likes, 0 repeats
       
       @foone oh wow I LOVED this game as a kid! I hadn't even thought about it in years.
       
 (DIR) Post #AwfdjtsXqSSGmpWb9E by artwaw@c.im
       2025-07-30T19:52:50Z
       
       0 likes, 0 repeats
       
       @foone we used similar technique in C64 ;)
       
 (DIR) Post #AwfgvwSuM0um96y0RM by foone@digipres.club
       2025-07-30T21:28:23Z
       
       0 likes, 0 repeats
       
       okay I was misunderstanding, I think.it's just DI, the high byte being the y coord, the low byte being the X coord. although... the screen is too wide for this to work.
       
 (DIR) Post #Awfh6QgAsFkGkUAmMS by foone@digipres.club
       2025-07-30T21:30:10Z
       
       0 likes, 0 repeats
       
       yeah something fucky is going on: it render ONE VALUE with an X coord >255
       
 (DIR) Post #AwfhA14e13EAUfKSK8 by foone@digipres.club
       2025-07-30T21:30:16Z
       
       0 likes, 0 repeats
       
       BUT HOW?
       
 (DIR) Post #AwfhP6kTCTFER95YpM by SvenGeier@mathstodon.xyz
       2025-07-30T21:33:32Z
       
       0 likes, 0 repeats
       
       @foone Only allow even-numbered x-coordinates?
       
 (DIR) Post #AwfiDXm0zpUOjSrRs8 by leonerd@fosstodon.org
       2025-07-30T21:42:44Z
       
       0 likes, 0 repeats
       
       @foone Drawing text starting that far right is unlikely. Maybe if it needs to start any further it left-pads with spaces?
       
 (DIR) Post #AwfkXQREB6YzgMkJW4 by foone@digipres.club
       2025-07-30T22:08:46Z
       
       0 likes, 0 repeats
       
       @SvenGeier good theory, but nope. 0001 is one pixel to the right of 0000
       
 (DIR) Post #AwfkixdL6C5loyuaA4 by foone@digipres.club
       2025-07-30T22:10:50Z
       
       0 likes, 0 repeats
       
       I love reverse engineering by breaking the code.I confirmed which function is drawing the background stars by replacing the first byte of it with CB (RETF)
       
 (DIR) Post #AwflH5ghey4aeAl9BA by deater78@mastodon.social
       2025-07-30T22:16:58Z
       
       0 likes, 0 repeats
       
       @foone the game also glitched out weirdly in cutscenes for me back in the day too.  We had a trident TVGA super vga card of some sort.
       
 (DIR) Post #AwfnXmt30w09AUcfya by foone@digipres.club
       2025-07-30T22:42:23Z
       
       0 likes, 0 repeats
       
       ghidra, if you know this code is at 231e:0bbe and it's MOV BYTE PTR CS:[0x44], 0WHY THE FUCK do you think that points to 1fb9:40b4? it's CS! CS:44! and CS is 231e. LERN TO MATH
       
 (DIR) Post #Awfnp4BrvuQTl0fKVM by foone@digipres.club
       2025-07-30T22:45:37Z
       
       0 likes, 0 repeats
       
       and if I double click the 44, I end up at 00:44WRONG AGAIN, GHIDRA
       
 (DIR) Post #Awfnz9ZCnZSPKNOI9Q by foone@digipres.club
       2025-07-30T22:47:20Z
       
       0 likes, 0 repeats
       
       231e:0002? that's not... No!
       
 (DIR) Post #Awfq7YqOtxr7wtZR9E by foone@digipres.club
       2025-07-30T23:11:16Z
       
       0 likes, 0 repeats
       
       the game stores the activation status for 39 missions.the game only has 17 missions
       
 (DIR) Post #AwfrnDmNi6S4ja7Tfs by kg6hxm@social.makerforums.info
       2025-07-30T23:29:58Z
       
       0 likes, 0 repeats
       
       @fooneAn extra bit in that? 17x2=38 close to 39?
       
 (DIR) Post #Awg12AunXbKTmYGI7c by SvenGeier@mathstodon.xyz
       2025-07-31T01:13:33Z
       
       0 likes, 0 repeats
       
       @fooneIt's been ages since I had to deal with x86 segmentation fuckery, but CS:[offset] is the same as (CS-1):[offset+16], no? Wait - is this 286 or 386 real mode? Those are different, right?
       
 (DIR) Post #AwgWIhRNTczps1rOBE by foone@digipres.club
       2025-07-31T07:03:43Z
       
       0 likes, 0 repeats
       
       @Patashu it does, but it's not exactly the greatest at it. much like DOS programs, it has problems with segmentation. usually not as bad, though
       
 (DIR) Post #AwgWQqWpZWQ8NBINI8 by foone@digipres.club
       2025-07-31T07:05:17Z
       
       0 likes, 0 repeats
       
       @AT1ST 1993!although it is shareware: you can pay to get the second half of the game. Although that comes as a second EXE, not an add-on. maybe part 2 uses more missions, and they just used the same mission code for both? I haven't checked yet.
       
 (DIR) Post #AwjTrKeiSvFCx3nkAK by foone@digipres.club
       2025-08-01T17:20:33Z
       
       0 likes, 0 repeats
       
       got damn ghidra. I have a disassembly that shows CMP BYTE PTR [0x0], 0x1and a decompilation that says:if(*(char*)0x0 == 1){I have told ghidra that DS for this segment is 1019. if I click on the 0x0 in the decompilation, I end up at 0000:0000. WRONGif I click on on the [0x0] in the disassembly, I end up at 231e:0. ALSO WRONG
       
 (DIR) Post #AwjTxPpO9GmujKh5do by foone@digipres.club
       2025-08-01T17:21:48Z
       
       1 likes, 0 repeats
       
       also yeah, fun segmented memory thing. NULL is a valid memory address and here it's used to determine if the mouse is enabled.
       
 (DIR) Post #AwjUnBNN7phey0H2dE by foone@digipres.club
       2025-08-01T17:31:09Z
       
       0 likes, 0 repeats
       
       *puVar4 = *puVar4;NO
       
 (DIR) Post #AwjUrseSAbH2LFVI9o by foone@digipres.club
       2025-08-01T17:32:02Z
       
       0 likes, 0 repeats
       
       the matching disassembly:MOV AH, byte ptr [DI]MOV byte ptr ES:[DI], AHDO YOU KNOW WHAT SEGMENT PREFIXES MEAN, GHIDRA?
       
 (DIR) Post #AwjZOIK2f5P52dfU7k by juandesant@mathstodon.xyz
       2025-08-01T18:22:39Z
       
       0 likes, 0 repeats
       
       @foone you’re sure that is a tool, and not a game posing as a tool?
       
 (DIR) Post #AwjbvIBQOoHc4iV36u by foone@digipres.club
       2025-08-01T18:51:04Z
       
       0 likes, 0 repeats
       
       found the cheat code (it's well known (it's in the MANUAL), but I hadn't seen the (machine/decompiled) code until now.
       
 (DIR) Post #AwjcPNNzcVUEtliv7w by asie@mk.asie.pl
       2025-08-01T18:56:51.071Z
       
       0 likes, 0 repeats
       
       @foone@digipres.club no, it probably doesn'twhen i worked on the reconstruction of zzt it also didn't understand segment boundaries, instead assuming each consecutive 64K was a "segment". the decompiler just gave up on that one big function on the boundary between 63 and 65K for that reason, as it kept misrouting PC-relative jumps
       
 (DIR) Post #AwjcUAGTpcwveTUc9Q by asie@mk.asie.pl
       2025-08-01T18:56:28.724Z
       
       0 likes, 0 repeats
       
       @foone@digipres.club no, it probably doesn'twhen i worked on the reconstruction of zzt it also didn't understand segment boundaries, instead assuming each consecutive 64K was a "segment". the decompiler just gave up on that one big function on the boundary between 63 and 65K for that reason.
       
 (DIR) Post #Awjh5nZx1du075nicq by foone@digipres.club
       2025-08-01T19:48:49Z
       
       0 likes, 0 repeats
       
       @asie ouch. segment-spanning functions are not something I've had to deal with yet
       
 (DIR) Post #Awjku2SyFSJGcyBSl6 by foone@digipres.club
       2025-08-01T20:31:42Z
       
       0 likes, 0 repeats
       
       found a copy-paste bug! the code that draws these three red dots miscolors the center of the rightmost one
       
 (DIR) Post #AwjlMEaAnIhaJUztfU by foone@digipres.club
       2025-08-01T20:36:47Z
       
       0 likes, 0 repeats
       
       the code looks like:MOV  AL, 0x34MOV  byte ptr ES:[button_offset  + 0xa07 ],ALMOV  byte ptr ES:[button_offset  + 0xb46 ],ALMOV  byte ptr ES:[button_offset  + 0xb48 ],ALMOV  byte ptr ES:[button_offset  + 0xc87 ],ALMOV  AL, 0x32MOV  byte ptr ES:[button_offset  + 0xb47 ],ALbut for the 3rd one, that second MOV AL,0x32 is instead MOV AL, 0x34. that's a copy-paste mistake, that is.
       
 (DIR) Post #AwjnK2ldx18x00Rh1k by foone@digipres.club
       2025-08-01T20:58:46Z
       
       0 likes, 0 repeats
       
       so if your gun is on 1-laser mode, it fires every 13-somethings (frames?)with it on 2-laser mode, it's every 19 somethingson 3-laser mode, it's every 30 sometimes.
       
 (DIR) Post #AwjnOvUQR8PLsLiiky by foone@digipres.club
       2025-08-01T20:59:39Z
       
       0 likes, 0 repeats
       
       yeah it's frames. at least logic frames, I don't think this game unhooks logic from framerate
       
 (DIR) Post #AwjvYlPrXnVfA6mumW by foone@digipres.club
       2025-08-01T22:31:00Z
       
       0 likes, 0 repeats
       
       huh! this game doesn't implement highlighted text by the usual way of just drawing the text in a different color.it instead iterates over the pixels in framebuffer and increases (or decreases, in the case of de-highlighting) the palette index
       
 (DIR) Post #AwjwKcHymX8wkqv0uu by foone@digipres.club
       2025-08-01T22:39:46Z
       
       1 likes, 0 repeats
       
       POP  AHPUSH AHPOP  AHIN OR OUT, MAKE UP YOUR MIND!
       
 (DIR) Post #AwjwOyXE0vleuK80AK by ar@is-a.cat
       2025-08-01T22:40:28Z
       
       0 likes, 0 repeats
       
       @foone this code is a cat
       
 (DIR) Post #AwjwjMwmxXGMPdoGUy by cinebox@masto.hackers.town
       2025-08-01T22:44:16Z
       
       1 likes, 0 repeats
       
       @foone average 00’s song lyrics
       
 (DIR) Post #Awjx2jYt6Sl23IrdU8 by madengineering@mastodon.cloud
       2025-08-01T22:47:05Z
       
       0 likes, 0 repeats
       
       @foone You do the hokey pokey and decompile around.That's what it's all about.
       
 (DIR) Post #AwjxYfkinihlVNd2p6 by fraggle@social.coop
       2025-08-01T22:53:30Z
       
       1 likes, 0 repeats
       
       @foone "i write my assembly in a boston accent"
       
 (DIR) Post #Awjxh2dvZweQobRRmy by Mandy_babie@mastodon.xyz
       2025-08-01T22:54:57Z
       
       0 likes, 0 repeats
       
       @foone I'm @Mandy_babie on #Mastodon! Come follow me at https://mastodon.xyz/@Mandy_babie
       
 (DIR) Post #Awjy3Iw3gV7riSXPdo by darkling@mstdn.social
       2025-08-01T22:59:05Z
       
       0 likes, 0 repeats
       
       @foone Followed by the little-known but vital HKY and CKY instructions, which are what that's all about.
       
 (DIR) Post #AwjyUZVcAljgw8Afh2 by amerika
       2025-08-01T23:04:28.912744Z
       
       0 likes, 0 repeats
       
       @cinebox @foone let's get retarded
       
 (DIR) Post #AwjybrC4oqg5oQVRzc by amerika
       2025-08-01T23:05:47.913921Z
       
       1 likes, 0 repeats
       
       @foone eat more fiber
       
 (DIR) Post #Awk49fVbGntBBja1pI by foone@digipres.club
       2025-08-02T00:07:23Z
       
       0 likes, 0 repeats
       
       so I went and beat the game while having a breakpoint on a function that tells me conversation IDs:1: Emer Kane2: Titus scientist3. Gimlak4: Titus (planet)5: Jelina (planet)6: ???7: Government8: ???9: ???10: Kima11: Rigelian Supply Depot12: Titus robot13: Titus hyperdrive ship14: Zookeeper alien15: Rigelian with stolen faceSo... something is missing!
       
 (DIR) Post #Awlc5Sd6npPtgcDXAO by foone@digipres.club
       2025-08-02T18:02:15Z
       
       0 likes, 0 repeats
       
       why write bool is_joystick_button_down(int button) when you can instead write two nigh identical functions:bool is_joystick_button_1_down()bool is_joystick_button_2_down()?
       
 (DIR) Post #AwlcA2SzVK4TzTfSpE by foone@digipres.club
       2025-08-02T18:03:13Z
       
       0 likes, 0 repeats
       
       I know programmers who don't use copy paste and they're all cowards
       
 (DIR) Post #AwlcCzsVaIDapc0vVQ by lp0_on_fire@social.linux.pizza
       2025-08-02T18:03:40Z
       
       0 likes, 0 repeats
       
       @foone, do they, by any chance, each call is_joystick_button_down() with an appropriate parameter?
       
 (DIR) Post #AwlcGAaEEteMtxybrc by deshipu@fosstodon.org
       2025-08-02T18:03:52Z
       
       0 likes, 0 repeats
       
       @foone Oh, I know that one! Because with certain tools it's easier to copy an entire function, than it is to add a parameter and handling to it.
       
 (DIR) Post #AwlcTY1WOt3jMg7c00 by foone@digipres.club
       2025-08-02T18:06:45Z
       
       0 likes, 0 repeats
       
       @lp0_on_fire nope. no parameters. this code actually very rarely uses parameters or return values, it's very globals-heavy.
       
 (DIR) Post #AwlccOpnvytPTJrVSK by foone@digipres.club
       2025-08-02T18:08:17Z
       
       0 likes, 0 repeats
       
       the only difference between the code is if it ANDs the result against 0x10 (button 1) or 0x20 (button 2).
       
 (DIR) Post #AwlcfJa7v8to36v2eG by foone@digipres.club
       2025-08-02T18:08:49Z
       
       0 likes, 0 repeats
       
       years ago I asked for the source for this game in the hopes of building a modernized version. I think I'm starting to see why I never got the source: it's slightly crap
       
 (DIR) Post #AwldynGHtYq7YYUX7Q by foone@digipres.club
       2025-08-02T18:23:33Z
       
       0 likes, 0 repeats
       
       this code does the following:sets joy_left to falsesets joy_right to falsereads the state of the joystickif this fails, it sets joy_left to false, joy_right to false, then returns. YOU DID THAT TWICE. IT'S ALWAYS FALSE
       
 (DIR) Post #Awle4wPKntSZewedcG by adriano@lile.cl
       2025-08-02T18:24:34Z
       
       0 likes, 0 repeats
       
       @foone it’s like a little dance.
       
 (DIR) Post #Awle7o2oM3CwadUADo by foone@digipres.club
       2025-08-02T18:24:40Z
       
       0 likes, 0 repeats
       
       this is in the function read_joystick_analog_x, which is the same as read_joystick_analog_y with one byte changed
       
 (DIR) Post #Awleko7hzjrI82NDYe by permik@mastodon.online
       2025-08-02T18:32:14Z
       
       0 likes, 0 repeats
       
       @foone wild guess, they just thought copy_pasting the function would've been easier and is more self documenting than encoding all of the button states to an int and then explaining how to check that button x is pressed with boolean logic.Keeping it simple for the stupid. (Themselves when they come back to their code after a break and have to re-learn how the damn thing even works :D)
       
 (DIR) Post #AwlfNo0uKv9T59mvey by eniko@mastodon.gamedev.place
       2025-08-02T18:39:15Z
       
       0 likes, 0 repeats
       
       @foone switch (button) {    default: return false;    case 1: return is_joystick_button_1_down();    case 2: return is_joystick_button_2_down();}perfect
       
 (DIR) Post #AwlggMbQZdiBWbHbvM by lunarood@mastodon.gamedev.place
       2025-08-02T18:53:50Z
       
       0 likes, 0 repeats
       
       @foone perhaps because of a lack of well-defined calling conventions, making register wrangling an unnecessarily stressful ordeal. Or maybe just because calling a function without arguments requires slightly less typing.All entirely legitimate reasons! /j
       
 (DIR) Post #Awlgngn9uQr2ASGOEy by lunarood@mastodon.gamedev.place
       2025-08-02T18:55:11Z
       
       0 likes, 0 repeats
       
       @foone I wish having "joy left" set to "false" wasn't such a relatable experience!
       
 (DIR) Post #AwliCt45W0XxQRlFAW by agowa338@chaos.social
       2025-08-02T19:10:50Z
       
       0 likes, 0 repeats
       
       @foone That sounds suspiciously like something I'd do to work around some dumb library bug where it changes state even if it failed...
       
 (DIR) Post #AwlzBtBtGCaQkNWKIa by TomF@mastodon.gamedev.place
       2025-08-02T22:21:09Z
       
       0 likes, 0 repeats
       
       @foone Wait - isn't this the correct way to read DOS analog joysticks? You ground them and time how long it takes for the signal to change?
       
 (DIR) Post #AwmCjoMl0IKh286oYi by david@fedi.machaj.info
       2025-08-03T00:52:45Z
       
       0 likes, 0 repeats
       
       @foone They probably used a C macro that embedded all the code. So the binary gets multiple nearly-identical copies but the code wasn’t quite so dumb as that makes it look.
       
 (DIR) Post #AwnIxudvFzvnRDClxg by foone@digipres.club
       2025-08-03T13:37:29Z
       
       0 likes, 0 repeats
       
       it keeps track of how many enemies/planets are on screen by adding 2 to a global variable in the render_enemies_and_missiles function.but why two? suspicious.
       
 (DIR) Post #AwnJ13ibyEY0SDtlqK by foone@digipres.club
       2025-08-03T13:37:41Z
       
       0 likes, 0 repeats
       
       on 16-bit system, 2 is a very suspicious number
       
 (DIR) Post #AwnJ8zE8YOVaqBQNeK by foone@digipres.club
       2025-08-03T13:39:33Z
       
       0 likes, 0 repeats
       
       yep there's an array of pointers!
       
 (DIR) Post #AwnLvfYWgA8TvhIpnM by foone@digipres.club
       2025-08-03T14:10:42Z
       
       0 likes, 0 repeats
       
       @RealGene it's the PC joystick port! it famously doesn't have enough buttons and expanding it was a huge pain!
       
 (DIR) Post #AwngMNw4ITgUBQKa1I by ann3nova@corteximplant.com
       2025-08-03T17:59:04Z
       
       0 likes, 0 repeats
       
       @foone
       
 (DIR) Post #AwuWxUEoBnCz0brvHM by foone@digipres.club
       2025-08-07T01:17:17Z
       
       0 likes, 0 repeats
       
       this file loading code is broken. it tries to load the file in 64kb chunks but it only saves the size as a 16bit variable, so a 64kb file will be recorded as 0, and any bigger file will break. but fortunately the file is only 11kb so it works, as the read-second-chunk behavior never triggers
       
 (DIR) Post #AwuXfqKZPRoqGpiM3U by foone@digipres.club
       2025-08-07T01:25:21Z
       
       0 likes, 0 repeats
       
       at least this is a compression algorithm that isn't too complicated: it's simple RLE.0xFF is a marker, and is followed by a byte of repeat count(-1) and a byte of value.
       
 (DIR) Post #AwuXj1fdhkj6JE5SkK by foone@digipres.club
       2025-08-07T01:25:48Z
       
       0 likes, 0 repeats
       
       although technically this is the second time I hacked this compression, I did figure this out already back in, like, 2013?
       
 (DIR) Post #AwubI0n9GQcxa5yQ7s by foone@digipres.club
       2025-08-07T02:05:48Z
       
       0 likes, 0 repeats
       
       this game uses a ton of hardcoded offsets into data files. I wonder if this was done with linker nonsense or if they had to be manually hardcoded in. the latter is scarily possibly
       
 (DIR) Post #AwuchUWLy82SyhpazI by agowa338@chaos.social
       2025-08-07T02:21:34Z
       
       0 likes, 0 repeats
       
       @foone For most of the horrors you're posting about I don't even know how one would do that intentionally.Probably shows that I only ever started to program after such "hacks" ware out of fashion for decades...
       
 (DIR) Post #AwudVYPxkpGlXkiJyC by foone@digipres.club
       2025-08-07T02:30:35Z
       
       0 likes, 0 repeats
       
       @snowfox that's what I hope, but I fear it's not the case
       
 (DIR) Post #AwudoLenQGMDT7c7Ki by foone@digipres.club
       2025-08-07T02:34:06Z
       
       0 likes, 0 repeats
       
       one of the performance things done in this code is that the blit function is fully inlined everywhere. given assembly, that probably means it's a macro
       
 (DIR) Post #AwufVanx4zior35408 by foone@digipres.club
       2025-08-07T02:53:07Z
       
       0 likes, 0 repeats
       
       oh god.the compression has two varieties. There's no header to determine which one is used. The difference? if the RLE runs are length-1 or just length.
       
 (DIR) Post #Awugl1Y026dE5rXcBM by foone@digipres.club
       2025-08-07T03:07:03Z
       
       0 likes, 0 repeats
       
       oh hey this is interesting: See this palette-cycling-ass effect? The palette never changes. This game must be doing that /in software/
       
 (DIR) Post #AwuheMgT9J2xZgtKE4 by RueNahcMohr@infosec.exchange
       2025-08-07T03:17:04Z
       
       0 likes, 0 repeats
       
       @foone haha
       
 (DIR) Post #AwujVE93j85cOU2Cvo by foone@digipres.club
       2025-08-07T03:37:49Z
       
       0 likes, 0 repeats
       
       okay, so this fire effect is being run dynamically: it's iterating over part of the screen buffer, and lowering/raising all non-zero pixels, and when those pixels hit values 90 or 111, the increasing/decreasing reverses.
       
 (DIR) Post #AwujZ7gNhEwTVcTipU by foone@digipres.club
       2025-08-07T03:38:35Z
       
       0 likes, 0 repeats
       
       but it's happening per-pixel, which means they need to keep track of which pixels are going up and which are going down. So there's some memory used to store that, right? they didn't hide it in VRAM?they didn't hide it... on screen?
       
 (DIR) Post #AwujjYxR8w1MzsQyjw by foone@digipres.club
       2025-08-07T03:40:27Z
       
       0 likes, 0 repeats
       
       IT'S RIGHT THERE, BABY!
       
 (DIR) Post #AwujvFPpcqvFrbHsW0 by foone@digipres.club
       2025-08-07T03:42:30Z
       
       0 likes, 0 repeats
       
       The game uses the palette entries 0 and 143 to determine if it's going up or down. #143 pixels are going down, #0 are going up. And both palette entries are set to pure black, so the fact that part of the screen is being used for algorithm storage isn't visible
       
 (DIR) Post #Awujz1HQ7jEVBH9StM by foone@digipres.club
       2025-08-07T03:43:16Z
       
       0 likes, 0 repeats
       
       it's at the top (left and right) and bottom because it was misplaced. The offset is wrong, so it loops around the segment (vertically), and it's placed too far to the right so it scrolls to the left side of the screen.
       
 (DIR) Post #Awuk1gOuD0GDIGvGy0 by foone@digipres.club
       2025-08-07T03:43:25Z
       
       0 likes, 0 repeats
       
       but since it's invisible, who cares?
       
 (DIR) Post #Awuk1kuFSPhzGdcMNM by foone@digipres.club
       2025-08-07T03:43:41Z
       
       0 likes, 0 repeats
       
       the developer may not have even known they misplaced it
       
 (DIR) Post #Awuk7BE31vBwLLSusy by foone@digipres.club
       2025-08-07T03:44:00Z
       
       0 likes, 0 repeats
       
       I could probably fix it, though.
       
 (DIR) Post #AwukMCvUzM8FxhxGMq by troldann@techhub.social
       2025-08-07T03:47:26Z
       
       0 likes, 0 repeats
       
       @foone Surely someone would have set the colors visible to see what it looks like, same as you did. But then if they're anything like me thought, "Oh, it's wrong. But it works. So is it wrong? Actually, this is better because it's funny."
       
 (DIR) Post #AwukkPHKiOs5DnhseW by Netux@mastodon.sdf.org
       2025-08-07T03:51:45Z
       
       0 likes, 0 repeats
       
       @foone unclosed parentheses in comment.
       
 (DIR) Post #AwuksiB6KatG9bkfwG by foone@digipres.club
       2025-08-07T03:53:12Z
       
       0 likes, 0 repeats
       
       this is what the logo loaded from the datafiles looks like: Since each pixel starts at a different state, we get the fire effect, instead of the whole thing just brightening and darkening in sync
       
 (DIR) Post #AwulHBQ7GFH9nTRaSG by bees@infosec.exchange
       2025-08-07T03:57:45Z
       
       0 likes, 0 repeats
       
       @foone looks like the gradient is changed through some sort of perlin noise generator.
       
 (DIR) Post #AwulLvIUdJrrEy8eOG by Netux@mastodon.sdf.org
       2025-08-07T03:58:28Z
       
       0 likes, 0 repeats
       
       @foone no fix, just make it so there is a config line to turn the black to a color.  It's a slick way to do it and should be left in, warts and all.
       
 (DIR) Post #AwurUUArReUzS12Dnk by cinebox@masto.hackers.town
       2025-08-07T05:07:15Z
       
       0 likes, 0 repeats
       
       @foone aaaand now I have Devin Townsend stuck in my head again
       
 (DIR) Post #Awus0vt1wjjOfMAOLQ by lethal_guitar@mastodon.social
       2025-08-07T05:13:08Z
       
       0 likes, 0 repeats
       
       @foone getting >64k file reading/writing wrong seems fairly common. I guess it was often a case of "Oh I need to support >64k files just in case" but never actually testing it
       
 (DIR) Post #AwuuQmVBf0CyzvT2au by rx13@infosec.exchange
       2025-08-07T05:40:15Z
       
       0 likes, 0 repeats
       
       @fooneThat seems to be the current industry consensus on adding LLM training siphons to everything
       
 (DIR) Post #AwvNeLGobMVZGTZ0CW by efi@chitter.xyz
       2025-08-07T11:07:33Z
       
       0 likes, 0 repeats
       
       @foone such a favorite
       
 (DIR) Post #Aww31nwwEbgOzeZZdw by foone@digipres.club
       2025-08-07T18:51:12Z
       
       0 likes, 0 repeats
       
       god this code.I KNOW PROGRAMMERS WHO REUSE COMMON CODE AS FUNCTIONS AND THEY'RE ALL COWARDS
       
 (DIR) Post #Aww449dOgKq8mU7J8S by foone@digipres.club
       2025-08-07T19:02:51Z
       
       0 likes, 0 repeats
       
       why have a load_sprite function when you can just inline slightly different file reading code once for every file you need to read?
       
 (DIR) Post #Aww4BfUed4jfcJbuCm by foone@digipres.club
       2025-08-07T19:04:15Z
       
       0 likes, 0 repeats
       
       it's also got a weird palette file.See, VGA is 6 bit per channel, not 8. But the palette files are 8 bits per channel. Does it shift off the lower two bits or something, so FFFFFF is 3F3F3F? not exactly!
       
 (DIR) Post #Aww4Hx1OND3liUv2jw by foone@digipres.club
       2025-08-07T19:05:26Z
       
       0 likes, 0 repeats
       
       it instead loads all palettes as 0000000 for all colors, then reloads the palette 63 more times, once a frame, while increasing each entry (if it's less than the original palette)
       
 (DIR) Post #Aww4LErAWG5xtrhl7w by foone@digipres.club
       2025-08-07T19:05:45Z
       
       0 likes, 0 repeats
       
       so 0x3F ends up as 0x3F, as does 0x40, 0x41, and so on up to 0xFF
       
 (DIR) Post #Aww71M42JOsEKBvxXk by foone@digipres.club
       2025-08-07T19:35:42Z
       
       0 likes, 0 repeats
       
       @mk is your former coworker James Schmalz? because that's who wrote this :)
       
 (DIR) Post #Aww8lQnl88TEICr50K by foone@digipres.club
       2025-08-07T19:55:23Z
       
       0 likes, 0 repeats
       
       @mk yikes
       
 (DIR) Post #AwwBDbdMeJGduBYVCy by StompyRobot@mastodon.gamedev.place
       2025-08-07T20:23:00Z
       
       0 likes, 0 repeats
       
       @foone Blame the compiler, it probably inlined it all behind their backs!
       
 (DIR) Post #AwwBKpyRjQKCPIrfGa by foone@digipres.club
       2025-08-07T20:24:20Z
       
       0 likes, 0 repeats
       
       ugh. this program uses the same DS value for all functions EXCEPT the communication-screen function and all subfunctions.which means you can assume the DS is the same UNLESS your function is communication-related, which isn't obvious at first. it's a mess to reverse
       
 (DIR) Post #AwwBNl6AJb2w9ersvY by foone@digipres.club
       2025-08-07T20:24:41Z
       
       0 likes, 0 repeats
       
       @StompyRobot no compiler, this was written in x86 assembly
       
 (DIR) Post #AwwBUyZibjHlyl8IYC by StompyRobot@mastodon.gamedev.place
       2025-08-07T20:25:46Z
       
       0 likes, 0 repeats
       
       @foone macros then
       
 (DIR) Post #AwwBYPiy7kFJ386C2a by foone@digipres.club
       2025-08-07T20:26:45Z
       
       0 likes, 0 repeats
       
       @StompyRobot I hope so, and it's not just all copy-paste
       
 (DIR) Post #AwwEcJ1THXMBHmIhsm by foone@digipres.club
       2025-08-07T21:01:07Z
       
       0 likes, 0 repeats
       
       @nikku4211 yeah no, this EXE is definitely not sizedcoded. it's got duplicate functions and near-identical copies of various code, so they clearly weren't worried about size