Post ApnRvEbsbQAWmd2hrU by johnlogic@sfba.social
 (DIR) More posts by johnlogic@sfba.social
 (DIR) Post #ApnQed4OJAvhlcteca by foone@digipres.club
       2025-01-06T05:59:01Z
       
       0 likes, 0 repeats
       
       you breakpoint at the function, and see the following 32 bits at the top of the stack.7B0E9721 what's the linear address of the return value? Well, obviously, it's2197:0E7B! you just gotta remember to reverse the bytes but not the nibbles, that'd be silly. Little Endian makes perfect sense.
       
 (DIR) Post #ApnQkOpu8q3jMMs8kC by foone@digipres.club
       2025-01-06T06:00:03Z
       
       0 likes, 0 repeats
       
       btw the colon in that 32bit address means I lied. That's not really the address. The address is, obviously, 227EB
       
 (DIR) Post #ApnQqfMxaJ2kNFK18S by foone@digipres.club
       2025-01-06T06:01:14Z
       
       0 likes, 0 repeats
       
       because the colon means this is 16-bit segmented x86! we're in Real Mode! and real mode is nonsense of a higher order
       
 (DIR) Post #ApnQvJmRHOY4rfSQpk by kboyd@phpc.social
       2025-01-06T06:02:01Z
       
       0 likes, 0 repeats
       
       @foone that's on Baker Street, right?
       
 (DIR) Post #ApnQxDvO1PorHaYFA8 by foone@digipres.club
       2025-01-06T06:02:12Z
       
       0 likes, 0 repeats
       
       @kboyd of course
       
 (DIR) Post #ApnRENtODOQr7Vnflo by foone@digipres.club
       2025-01-06T06:05:32Z
       
       0 likes, 0 repeats
       
       You've got two 16-bit integers, called the segment (or segment selector, or just selector) and your offset. And it'd make sense that those are just two chunks of a larger 32bit linear address, but they're not. They're two 16-bit chunks of a 20-bit address.
       
 (DIR) Post #ApnRMyZdiaKjCbevU8 by foone@digipres.club
       2025-01-06T06:07:05Z
       
       0 likes, 0 repeats
       
       and that'd make sense if only the lower 4 bits of the segment were used.but all bits are used. They just add the segment and the offset together, after bitshifting the segment over by 4.So the linear address of AAAA:BBBB is AAAA*16+BBBB.
       
 (DIR) Post #ApnRU5ryzU2ZrCdIno by foone@digipres.club
       2025-01-06T06:08:21Z
       
       0 likes, 0 repeats
       
       this does mean that you can make multiple pointers to the same address that have different bit patterns, yes.
       
 (DIR) Post #ApnRWTVm3uDNlBNejY by foone@digipres.club
       2025-01-06T06:08:48Z
       
       0 likes, 0 repeats
       
       so you can have two pointers to the same object but ptr1 != ptr2. This makes programming in real mode Extra Fun!
       
 (DIR) Post #ApnRqOCJWpSp4Sm3MW by foone@digipres.club
       2025-01-06T06:12:23Z
       
       0 likes, 0 repeats
       
       I dunno. I don't even want to go into Near vs Far pointers and how you have implicit segments (so if you see MOV AX, [1234], you know it gets a value from address 1234, but you don't know WHICH 1234 they mean)but I had to turn 7B0E9721 into 2197:0E7B in my head and I had a sudden realization of HOW FUCKING STUPID THIS WAS
       
 (DIR) Post #ApnRsk7kyeZLeblTWq by foone@digipres.club
       2025-01-06T06:12:43Z
       
       0 likes, 0 repeats
       
       I LIKE USING MODERN DEBUGGERS WHERE POINTERS REMEMBER HOW TO POINT TO THINGS WITHOUT BEING IN PARTS I HAVE TO MANUALLY PUT TOGETHER
       
 (DIR) Post #ApnRvEbsbQAWmd2hrU by johnlogic@sfba.social
       2025-01-06T06:13:06Z
       
       0 likes, 0 repeats
       
       @foone Did you perhaps mean *ptr1 != *ptr2 ?
       
 (DIR) Post #ApnRxXZh3yO8BG7To8 by foone@digipres.club
       2025-01-06T06:13:41Z
       
       0 likes, 0 repeats
       
       @johnlogic No, it's the pointer addresses that are different, not their content
       
 (DIR) Post #ApnSBfXWFL9WwBq72O by johnlogic@sfba.social
       2025-01-06T06:16:09Z
       
       0 likes, 0 repeats
       
       @foone ah, now I see...
       
 (DIR) Post #ApnSRDFnBFlTqMxZFA by otte_homan@theblower.au
       2025-01-06T06:18:59Z
       
       0 likes, 0 repeats
       
       @foone this is like the whole big endian - little endian thing cubed. What a fvcking mess.
       
 (DIR) Post #ApnT1lV3KcOCTtWkd6 by RueNahcMohr@infosec.exchange
       2025-01-06T06:25:38Z
       
       0 likes, 0 repeats
       
       @foone I KNOW I SPECIFIED THE ADDRESS, BUT HELL IF I KNOW WHERE THE VARIABLE IS!
       
 (DIR) Post #ApnW6077EscmpI2gNM by foone@digipres.club
       2025-01-06T06:59:55Z
       
       0 likes, 0 repeats
       
       I've currently got a dos game open in both Ghidra and DOSBox and I'm going to 2978:0E7B and it's different in DOSBox, cause it's off by 64 bytes. why? I don't know. DOS hates me
       
 (DIR) Post #ApnWKDHX4rQpiigwQS by foone@digipres.club
       2025-01-06T07:02:34Z
       
       0 likes, 0 repeats
       
       why? BECAUSE SEGMENTED POINTERS ARE MADE OF HATRED
       
 (DIR) Post #ApnYGd0JhTpMFM3c8G by realMagnesium12@troet.cafe
       2025-01-06T07:24:16Z
       
       0 likes, 0 repeats
       
       @foone But how do you actually compare two segmented pointers "the save way?"
       
 (DIR) Post #ApnYaEuL03ZRIwc0dU by RavenLuni@furry.engineer
       2025-01-06T07:27:52Z
       
       0 likes, 0 repeats
       
       @foone Is it being loaded at different points due to environment settings?
       
 (DIR) Post #ApnZN35zhmtIrNL2v2 by PeterSommerlad@mastodon.social
       2025-01-06T07:36:38Z
       
       0 likes, 0 repeats
       
       @foone welcome to the world of my first professional programming experience...
       
 (DIR) Post #ApnabgLWfZHAbM92ES by foone@digipres.club
       2025-01-06T07:50:31Z
       
       0 likes, 0 repeats
       
       @realMagnesium12 generally "you don't" but if you have to, you'd have to calculate the linear addresses and compare those
       
 (DIR) Post #ApnanhTQItG7ZaZMTQ by JoshJers@peoplemaking.games
       2025-01-06T07:52:31Z
       
       0 likes, 0 repeats
       
       @foone all my time teaching myself  to program in real mode back then and I never once made that connection
       
 (DIR) Post #ApnbrGyqqWkaWDXMK8 by root42@chaos.social
       2025-01-06T08:04:28Z
       
       0 likes, 0 repeats
       
       @foone if there is no prefix it should be DS:[1234], or…?
       
 (DIR) Post #ApncHRXgCUNEnwJ4ng by foone@digipres.club
       2025-01-06T08:09:18Z
       
       0 likes, 0 repeats
       
       @root42 yeah, it's DS. what's DS set to at this time, though? that's why it's tricky
       
 (DIR) Post #Apnf0K9GjjX4oSPvzU by root42@chaos.social
       2025-01-06T08:39:44Z
       
       0 likes, 0 repeats
       
       @foone ha, yes! That's of course tricky. Side effects are a bitch. :)
       
 (DIR) Post #ApngpZy3mSuqb9B8Pw by max@mastodon.xolus.net
       2025-01-06T09:00:08Z
       
       0 likes, 0 repeats
       
       @foone Oh, I have very fond memories of this one.15yro-me gave up on reverse entirely, because of this; I thought there was no way this was correct and I'm just not good enough to figure it out.This, and also that nobody told me the dos debug.exe wouldn't be very useful on Win95.Fun times.
       
 (DIR) Post #ApnpBFlONbfFwK6DiK by brouhaha@mastodon.social
       2025-01-06T10:33:47Z
       
       0 likes, 0 repeats
       
       @foone 🎶 1 little, 10 little, 11 little endians
       
 (DIR) Post #Apo3WHQIno8MWk9gPo by cubindercat@mastodon.social
       2025-01-06T13:14:25Z
       
       0 likes, 0 repeats
       
       @foone it may be stupid, but think about how fun it is to be able to finally write into the forbidden memory location 0x0000!i've actually used that once to be able to copy a big chunk of data from one point to another, where both addresses were actually 0 before taking the segments into account. as long as the data fits into a single segment, no need for further segment calculations during the copying.still stupid, obviously.
       
 (DIR) Post #Apo9EP6c6GFurlnyz2 by Craigp@mastodon.social
       2025-01-06T14:18:22Z
       
       0 likes, 0 repeats
       
       @foone ah, I finally understand what that old song is about.near, far, wherever you are...
       
 (DIR) Post #ApoHgf7WwyIUHEDg6C by ask@infosec.exchange
       2025-01-06T15:53:08Z
       
       0 likes, 0 repeats
       
       @foone hey 1MB is a lot of RAM! We really have to stretch to make it fit in address space
       
 (DIR) Post #ApoHvJh2tkDwAJorWC by ask@infosec.exchange
       2025-01-06T15:55:52Z
       
       0 likes, 0 repeats
       
       @foone my favorite thing about this is the 1981 IBM PC had literally 4 rows of ram chips each making up 64k which is exactly one segment size.So if you space out your segments by 64k then the segment register is literally just selecting which of the 4 rows of chips to use.You can also expand it with an additional 10 non-overlapping segments for 14 total (the rest of the address space is ROM).
       
 (DIR) Post #ApoLfLBvxZFLzlu9Im by tomjennings@tldr.nettime.org
       2025-01-06T16:37:44Z
       
       0 likes, 0 repeats
       
       @foone You can get used to anything.  I wrote lots of 8086 code. Comparing pointers is a bad idea anyway. It's all from the telegraphy and knobs and dials days. Offset is a vernier on segment. And you normalize a lot. for (i= 60000; --i > 0;) {  *p++= *s++;}You have to normalize s and p first, so that their offsets don't wrap within the segment. EASY! aaarrgggggghhhhh
       
 (DIR) Post #ApoMExzZgwuST86yDw by tomjennings@tldr.nettime.org
       2025-01-06T16:44:12Z
       
       0 likes, 0 repeats
       
       @foone @johnlogic With Intel fkn segmentation, there are what, 2^^12 segment:offset values that reference the same memory location.  Writing disk DMA drivers, you had to break some xfers into three chunks, if the xfer block crossed an absolute 64K boundary.  16 bit DMA chips didn't segment, they're absolute, eg. 16 plus a 4 bit register for address bits 17..20.The PDP-8 was worse.
       
 (DIR) Post #AppVPJHSURkc8RRXwO by foone@digipres.club
       2025-01-07T06:01:40Z
       
       0 likes, 0 repeats
       
       @ask Heh, that's a neat way to look at it!