Post Av3bcBW4AEfaNf6lgO by jbqueru@floss.social
(DIR) More posts by jbqueru@floss.social
(DIR) Post #Av3YzNxLmKoflEF1oO by foone@digipres.club
2025-06-12T14:08:09Z
0 likes, 0 repeats
hacking on Star Trek: Judgement Rites.I set a memory breakpoint on the VGA buffer, and BAM! I see the dialog system draw one of those fancy transparent dialogs. So what code is making this change?ADD SP,000A... what?
(DIR) Post #Av3Zm0xc45UEd8YJJA by SecureOwl@infosec.exchange
2025-06-12T14:17:00Z
0 likes, 0 repeats
@foone wow that screenshot is bringing back some childhood memories
(DIR) Post #Av3ZrI65mJZDE82CQK by foone@digipres.club
2025-06-12T14:17:59Z
0 likes, 0 repeats
I call this memory dump "silence on the bridge"
(DIR) Post #Av3Zupkl6RDqTfkGiO by saua@troet.cafe
2025-06-12T14:18:24Z
0 likes, 0 repeats
@foone Very carefully organized palette where every color (that can have a dialog painted over it) has the "same, but darker" version exactly 10 slots later?
(DIR) Post #Av3aJpmS8dYnnmSVY8 by foone@digipres.club
2025-06-12T14:23:10Z
0 likes, 0 repeats
@saua that's what I figured yeah, but the palette isn't arranged to do that. I think they've got a lookup map somewhere
(DIR) Post #Av3aSIiMRjEVr7a9Ym by foone@digipres.club
2025-06-12T14:24:43Z
0 likes, 0 repeats
so the dosbox debugger is stopped at 1376:C506, an ADD command. I hit F11, "STEP INTO", and the debugger moves to 1376:C4F6, a PUSH.F11 again, I'm at 1376:6D38, another PUSH.F11 again, I'm at 1376:6D4d, a MOV. GO HOME x86 YOU'RE DRUNK
(DIR) Post #Av3aVx2Mz3WVmcgK7k by foone@digipres.club
2025-06-12T14:25:20Z
0 likes, 0 repeats
dynamic core: not even once
(DIR) Post #Av3atC0PUvAmrpqbdA by foone@digipres.club
2025-06-12T14:29:31Z
0 likes, 0 repeats
I don't know why there are so many memcopies in 90s DOS software. like, it turns out the function I'm looking at is a memcopy, right? I guess they had to write their own because their compiler didn't provide one?well, no, because ghidra found the libc's memcpy. they wrote their own for unknown reasons
(DIR) Post #Av3b0bVT5HkJz4uOGW by foone@digipres.club
2025-06-12T14:30:55Z
0 likes, 0 repeats
putting aside that Real Mode software often had (at least) two memcopies: you need a near one and a far one. god help you if you also need near-to-far and far-to-near
(DIR) Post #Av3b40qhJn6HS1Sp9M by foone@digipres.club
2025-06-12T14:31:22Z
0 likes, 0 repeats
billiam t. gates: 4 memcpys ought to be enough for anyone
(DIR) Post #Av3bWHJfgdHgdEUhY8 by foone@digipres.club
2025-06-12T14:36:36Z
0 likes, 0 repeats
found a priority bitmap
(DIR) Post #Av3bZMJbYbih0KvqSm by KeyJ@mastodon.gamedev.place
2025-06-12T14:37:01Z
0 likes, 0 repeats
@foone Since x86 has a dedicated memcpy instruction, just setting DS:SI, ES:DI and CX and running a "rep movs" is in many ways better than pushing all these parameters onto the stack and doing a (possibly far) call. It's less code, it's faster ... what's not to like?
(DIR) Post #Av3bcBW4AEfaNf6lgO by jbqueru@floss.social
2025-06-12T14:37:26Z
0 likes, 0 repeats
@foone When I worked in the Android team at Google, we used to count the number of Base-64 decoders, those would sprout everywhere...
(DIR) Post #Av3bmClSNUy59E5KO8 by foone@digipres.club
2025-06-12T14:39:29Z
0 likes, 0 repeats
@KeyJ yeah but they do a farcall to this rep movs-based memcopy. just like the other memcpy they sometimes use
(DIR) Post #Av3brhDCbPBT1jgHq4 by KeyJ@mastodon.gamedev.place
2025-06-12T14:40:30Z
0 likes, 0 repeats
@foone OK, *now* I fully understand your complaint! :)
(DIR) Post #Av3cDbaYBslBxP36lk by jbqueru@floss.social
2025-06-12T14:44:26Z
0 likes, 0 repeats
@foone Fun factoid: on 68000, the MOVEM instruction (M->R) does one extra read beyond the end of the actual data. That means that it's not safe to use at the very end of a block of physical memory. Depending on implementations, that might result in having 2 versions of memcpy.E.g. on Atari ST, you can't simply copy the ROM to RAM by doing a pair of MOVEM in a loop, the last read crashes with a bus error when it reads beyond the end of the ROM.
(DIR) Post #Av3cPbX4E22tG38pdI by foone@digipres.club
2025-06-12T14:46:38Z
0 likes, 0 repeats
found the backbuffer I'm and watching for that get drawn on.it seems to be doing it in horizontal 8-pixel-wide chunks? weird
(DIR) Post #Av3dgo2j42o0w5iReq by foone@digipres.club
2025-06-12T15:00:44Z
0 likes, 0 repeats
I'm back on my "figure out what it does by breaking it" bullshit.I disabled an IF (OR/JZ) and now the dialog boxes have opaque backgrounds!
(DIR) Post #Av3e3090khQcq3EtUW by foone@digipres.club
2025-06-12T15:04:56Z
0 likes, 0 repeats
specifically it seems to be blitting in 8x11 pixel chunks. I don't know why that is.
(DIR) Post #Av3e8KAVjKhyOGTke0 by foone@digipres.club
2025-06-12T15:05:50Z
0 likes, 0 repeats
@fortyseven that's the great thing about quality pixel art, it doesn't really age!
(DIR) Post #Av3eXASqwmQBX6u92W by foone@digipres.club
2025-06-12T15:10:12Z
0 likes, 0 repeats
@unnick oh that makes sense! it may be exactly that
(DIR) Post #Av3f1ni5b3xfwHdcw4 by foone@digipres.club
2025-06-12T15:15:49Z
0 likes, 0 repeats
Found it! There's a lookup table that remaps the palette to a darker version of each color. (Doom called these COLORMAPS) So when it's trying to draw a dialog over the screen, it looks up each pixel in the COLORMAP instead of just using a 1:1 mapping. Thus, the background darkens, even in a 256-color mode that can't do color blending.
(DIR) Post #Av3fGKwmoq4n4mRaQy by foone@digipres.club
2025-06-12T15:18:34Z
0 likes, 0 repeats
I have no idea how I'm going to implement this into the death generator. it DOES support alpha blending, which makes doing this kind of palette-based stuff harder. I might pre-process every background and have a pre-darkened version, then just blit that over the non-darkened version?
(DIR) Post #Av3gO5Lmn7JoyTObiq by foone@digipres.club
2025-06-12T15:31:08Z
0 likes, 0 repeats
as @unnick pointed out, the 8x11 is the font size.I found the font but it's encoded weird. It's 22 bytes per character.The weird part is that they encoded it as effectively two 1bpp 8x11 images, which then are combined into a 2bpp image.
(DIR) Post #Av3gSbhmRHHcTlq7sW by foone@digipres.club
2025-06-12T15:31:27Z
0 likes, 0 repeats
I assume this made sense in some other mode. planar EGA, maybe?
(DIR) Post #Av3gXuHwm36ZYvHdmy by gsuberland@chaos.social
2025-06-12T15:32:18Z
0 likes, 0 repeats
@foone @unnick lol bitplanes in 2bpp
(DIR) Post #Av3ghvnzzMjNAA3VSq by gsuberland@chaos.social
2025-06-12T15:34:40Z
0 likes, 0 repeats
@foone maybe it's so they can more easily support rendering in 1bpp and 2bpp depending on context and settings?
(DIR) Post #Av3hBRURGWRFpQyj2m by foone@digipres.club
2025-06-12T15:40:02Z
0 likes, 0 repeats
@gsuberland could be!
(DIR) Post #Av3i8NI2WZfBt7HQ1I by foone@digipres.club
2025-06-12T15:50:38Z
0 likes, 0 repeats
ugh. this is the wrong font.It has the same SHAPE, so I think it's based on the same underlying data, but this font only has 3 levels: on, shadow, off.The font I'm targetting has 4 levels
(DIR) Post #Av3jXDjVIIi7RPXNJY by erincandescent@akko.erincandescent.net
2025-06-12T16:01:09.614093Z
0 likes, 0 repeats
@foone you only really need two, because every near pointer can be converted to a far pointerAnd memcpy is probably just rep movsb under the hood anyway
(DIR) Post #Av3jXF6EDITxgBB2NE by foone@digipres.club
2025-06-12T16:06:16Z
0 likes, 0 repeats
@erincandescent nope! too slow.You gotta use rep MOVSW to move 16bits at a time, then movsb the last byte if needed. (modern memcpys do this too, or worse: page-copying nonsense might be involved)
(DIR) Post #Av3jtspnA1ZDHmHjg8 by foone@digipres.club
2025-06-12T16:10:31Z
0 likes, 0 repeats
@erincandescent but yeah, you should only need two memcpys. I still keep finding more than that, though.
(DIR) Post #Av3ldsboQn1xrTF7Wi by foone@digipres.club
2025-06-12T16:29:55Z
0 likes, 0 repeats
Captured the whole font!At the wrong size! Fuck!
(DIR) Post #Av3m4npKJoX0qhOyo4 by foone@digipres.club
2025-06-12T16:34:55Z
0 likes, 0 repeats
got all the glyphs. Next steps, unicode matching and figuring out how many palette variations this font comes in
(DIR) Post #Av3moAZeakQiQghgQ4 by n1vux@mastodon.radio
2025-06-12T16:42:52Z
0 likes, 0 repeats
@foone that's quaint!
(DIR) Post #Av3nU7QifhkgqBWm6S by plaidtron3000@jorts.horse
2025-06-12T16:50:34Z
0 likes, 0 repeats
@foone Isn't 8x11 the standard VGA DOS font size? I don't know why they'd care for graphics modes, but maybe they found a performance sweet spot there.
(DIR) Post #Av3xIhfv5PbZJsphJI by ozone89@techhub.social
2025-06-12T18:40:31Z
0 likes, 0 repeats
@foone pinging @georgetakei for reasons :3