Live data from Hacker News

Win16 Memory Management

os2museum.com

31–40 of 86 posts

Re: Win16 Memory Management

#31
post #3
post #2

Sometimes I think that if it were the old days, I probably wouldn't have been able to program. I remember that these days we program on top of 64bit virtual addresses, but how did developers do it back then

Attention spans were longer.

I have been wondering how to train my 6-year old son and myself to increase my attention span.

Some rules are obvious -- cutoff mobiles and pads completely (he doesn't have access to them so it's for me), sit in the library and study from books (I believe this is even possible for programming topics as I can write on paper). Basically, cutting off everything electronics definitely helps -- even putting my phone in the bag improves productivity significantly.

But the problem is, my son is unruly. If I put him in the library, most likely he runs around and messes things up, which ends up we leave early without doing anything.

Re: Win16 Memory Management

#32
post #4

Earlier quoted context omitted.

16 bit programs used 16 bit addresses, generally speaking. Even with 32bit systems where you’d want more than 4GB RAM, application software still had 32 bit addresses (and thus 4GB memory limit). I think it was a lot more common for 8bit systems to allow for 16 bit addressing though. It’s been a while though. So hopefully I’m not misremembering things.

> I think it was a lot more common for 8bit systems to allow for 16 bit addressing though. The 6502 and Z80 could use 16 bit addressing to access up to 64kb of memory. The 6502 had various other addressing systems, including iirc 8 bits, but none of them were wider tha 16 bits.

Oh yeah. I had loads of 6502 and Z80 systems (still do in fact). Can’t believe I forgot about that!

Though in fairness, I do mostly now just use those systems to teach my kids BASIC

Re: Win16 Memory Management

#33
post #5
post #3

Earlier quoted context omitted.

Attention spans were longer.

I've been wondering about this lately. As a kid, I spent hour upon hour learning about computing: typing in Basic code from a magazine into a Commodore 64, playing with music on an Atari STe, learning my way around a DOS command line, dabbling with 3D modelling... just so much stuff that my own kids would never have the patience for. I wonder if it's just that kids today (gods that makes me sound old!) are constantly…

I have been shielding my 6 years old son from electronics, except 40 minutes of TV twice a week. I have no idea how to grow his patience and perseverance, though. He is like me, who doesn't have a lot of patience to begin with, so I can't really guide him through some of the situations. We have been taking him to some activities as well as reading to him but nothing really sticks.

I just hope eventually he loves reading and learns in a more traditional way instead of from laptops and pads.

Re: Win16 Memory Management

#34
> Exports are used for application code which is externally called.

This was the magic moment for me, learning Windows 3.0 programming. The idea that my program is no longer master of it's world, but instead is just something that gets loaded and called by Windows.

Re: Win16 Memory Management

#35

I've been recently working with Classic Mac OS programming[0] and just that memory model (also using dealing with the lack of virtual memory using opaque handles to memory that need to be locked when used) is painful enough[1] - having to deal with segment addressing on top of that does not sound like fun. Thank god for the Motorola 68000! [0]Made an AppleTalk chat client/server https://github.com/kalleboo/GlobalTalk…

It wasn't really the processor architecture. Segmented addressing was actually fairly easy if the processor was used only in the way that protected mode was envisioned as working. As the headlined article observes, a lot of this stuff simply wasn't necessary in OS/2 1.x, even though that too had DLLs, callback window procedures, and the multiple tiny/small/medium/large/compact/huge memory models.

The differences were (a) that DOS+Windows was designed so that the same programs could run in both real mode, with overlaying, and 286 protected mode, with segmented virtual memory; and (b) that to really save on RAM DOS+Windows had ideas such as the data segments for DLLs being globally shared across all processes. These added all of the complications mentioned in the headlined article and more besides. It was the operating system, not the processor architecture.

Re: Win16 Memory Management

#36
post #5

Earlier quoted context omitted.

I've been wondering about this lately. As a kid, I spent hour upon hour learning about computing: typing in Basic code from a magazine into a Commodore 64, playing with music on an Atari STe, learning my way around a DOS command line, dabbling with 3D modelling... just so much stuff that my own kids would never have the patience for. I wonder if it's just that kids today (gods that makes me sound old!) are constantly…

I have been shielding my 6 years old son from electronics, except 40 minutes of TV twice a week. I have no idea how to grow his patience and perseverance, though. He is like me, who doesn't have a lot of patience to begin with, so I can't really guide him through some of the situations. We have been taking him to some activities as well as reading to him but nothing really sticks. I just hope eventually he loves read…

We struggled to get our son into reading too, but he took straight away to comics, and from there he had a long stint with graphic novels (e.g. Percy Jackson, Artemis Fowl). You can get more mature graphic novels as they mature and progress, e.g. City of Dragons. And eventually he picked up an Alex Rider book, and hasn't stopped since. He's now how I remember myself as a kid - nose stuck in a book, completely engrossed!

Re: Win16 Memory Management

#37
Pretty good detail in this article! But what really surprises me is how some ideas just keep coming back.

When I wrote a binary translator, I ended up having to keep a translated return stack to optimize RET opcodes. That put me in exactly the same position as the Win16 kernel with regard to having to patch pointers (in case of Win16, just the segment part) on stack.

Of course I did not have the benefit of my guests calling a lock function, so I ended up having to run a garbage collection operation to determine which pointers are in use & take exceptions on now-invalidated segments. Lots of extra work that Windows didn't need: it's nice to be king :-)

Re: Win16 Memory Management

#38
post #4

Earlier quoted context omitted.

16 bit programs used 16 bit addresses, generally speaking. Even with 32bit systems where you’d want more than 4GB RAM, application software still had 32 bit addresses (and thus 4GB memory limit). I think it was a lot more common for 8bit systems to allow for 16 bit addressing though. It’s been a while though. So hopefully I’m not misremembering things.

> I think it was a lot more common for 8bit systems to allow for 16 bit addressing though. The 6502 and Z80 could use 16 bit addressing to access up to 64kb of memory. The 6502 had various other addressing systems, including iirc 8 bits, but none of them were wider tha 16 bits.

Well, most of the addressing modes of the Z80 used a 16-bit register pair (i.e. 0 to 64K-1 bytes) to address, the 6502 used a somewhat stranger set of addressing modes, but once again you could address 0 to 64K-1 bytes.

Re: Win16 Memory Management

#39
post #35

I've been recently working with Classic Mac OS programming[0] and just that memory model (also using dealing with the lack of virtual memory using opaque handles to memory that need to be locked when used) is painful enough[1] - having to deal with segment addressing on top of that does not sound like fun. Thank god for the Motorola 68000! [0]Made an AppleTalk chat client/server https://github.com/kalleboo/GlobalTalk…

It wasn't really the processor architecture. Segmented addressing was actually fairly easy if the processor was used only in the way that protected mode was envisioned as working. As the headlined article observes, a lot of this stuff simply wasn't necessary in OS/2 1.x, even though that too had DLLs, callback window procedures, and the multiple tiny/small/medium/large/compact/huge memory models. The differences were…

I understood it as Windows developers had to manually deal with segment limitations since Windows supported running on pre-286 CPUs without protected mode (Wikipedia says Windows 1-3 all supported the 8088). OS/2 just made the 286 a minimum requirement so they could rely on a CPU with more modern features.

The 68k didn't come with an MMU like the 286 so MacOS couldn't rely on virtual memory like OS/2 did but at least the flat memory space meant you didn't have to juggle 64k segments

Re: Win16 Memory Management

#40
If you think programming in Win16 (or whatever we want to call it), you should try teaching people to do it. I worked as a commercial trainer on C and Windows way back when - C and the Windows API were no bed of roses, but the different memory models were mind-numbing for us tutors and the poor punters, many of whom didn't know C!
Post reply on HN