Live data from Hacker News

Win16 Memory Management

os2museum.com

61–70 of 86 posts

Re: Win16 Memory Management

#61
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

I think programming often was easier back then. You didn’t have to know about 120 AWS services or security issues. The world was pretty small and you could mostly understand all details of the system you worked on. But it was more tedious for sure.

Re: Win16 Memory Management

#62
post #32

Earlier quoted context omitted.

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

Just curious how do you teach kids BASIC. I’m sure my 6 year old won’t sit tight.

I usually start with game: guess the number.

The computer generates a random number between 1 and 100. And you have to guess. When you’re too high, the computer says “too high” and likewise when you’re too low.

It’s a great starter program because it teaches you strings (the output printed), integers, comparisons, conditionals, and iteration (you keep guessing until you get it right). And the whole thing only take around 20 lines (give or take).

Then the kids plays a few games of that.

And after the novelty of that game wears off, I tell them to customise it however they want. Eg different messages, different ranges to guess from, etc.

It’s the same way I teach Python to primary school / kindergarten kids.

The nice things about this is even if the kids don’t learn and remember the basic primitives, they still get a feel of “proper” coding in the same way that we did when we grew up. And they still get something they can play, even if the game itself is super basic (no pun intended).

I’m not saying this will work with every child, though. All kids are different. But it’s been super successful both at home and in the schools I’ve helped out at.

Re: Win16 Memory Management

#63
post #12

Earlier quoted context omitted.

I guess it was awkward to use languages that had higher level than assembly in order to write 16-bit programs that required more than 64KiB of memory. And also not quite portable, since they were all tied to x86 CPU. Those were messy times I guess. A somewhat similar story was 32-bit PAE, where the the CPU could address more than 4GiB physical memory, but software was still 32-bit and virtual addresses were capped at…

"portable" used to mean "able to be ported" rather than the "comes automatically ported if you just change compiler options" that it means today

All software is portable by that former definition.

When people talked about portable before, they meant code that used an abstraction that was platform agnostic. And that’s how it’s still used today. It’s just we have better abstractions now so our expectations of what is “portable” have gotten stricter.

Eg the P in POSIX (which is nearly 40 years old now) is “portable”. The point of POSIX was to provide common abstractions that one could build against to run on multiple different operating systems. It wasn’t about porting software, it was about preventing people from needing to constantly write platform-specific ports.

Re: Win16 Memory Management

#65
post #42

In 1994 I was 2 years out of school. I'd written one windows shareware application and a whole lot of unix-y things. People were excited about the internet but most people didn't have access. Unix shell accounts via dialup were common though. One day I was encouraged to write a Windows Sockets emulation layer for ordinary dial-up shell accounts like those offered by netcom. The idea was to allow the use of the recent…

> Windows 3.1 had no memory protection at all

All of the below is... IIRC

Win16, even in protected mode, in general didn't unless you opted out of the shared VDM. This was to preserve compatibility with how non-protected mode code worked. That said 32bit code or code that specifically marked itself as protected mode got it's own memory space.

> I just couldn't wrap my head around the idea that I'm multitasking operating system could exist without memory protection

NGL... I was shocked when I found out that MacOS before 10... really didn't have much protections at all.

Re: Win16 Memory Management

#66
post #22

Earlier quoted context omitted.

As someone who grew up coding after it was mostly 32-bit, I can't say this with certainty, but my gut feeling is that paradoxically you would have and it would've made you stronger.

Exactly. I'd argue that all those programming Gods and Gods because they went through that period. Whatever didn't kill them made them stronger. We should replicate that experience by deliberately writing in low level C and assembly for a few years.

>"by deliberately writing in low level C and assembly for a few years"

Ha. kid's stuff. I started with punching machine codes straight into memory

Re: Win16 Memory Management

#67
post #63

Earlier quoted context omitted.

"portable" used to mean "able to be ported" rather than the "comes automatically ported if you just change compiler options" that it means today

All software is portable by that former definition. When people talked about portable before, they meant code that used an abstraction that was platform agnostic. And that’s how it’s still used today. It’s just we have better abstractions now so our expectations of what is “portable” have gotten stricter. Eg the P in POSIX (which is nearly 40 years old now) is “portable”. The point of POSIX was to provide common abst…

It was about making software easier to port. You still couldn't necessarily just write software for all operating systems at once, but you had less porting work because less stuff was different because of the standardisation. So open(argv[1], O_RDONLY) works on all POSIX systems, but if you want to create a pseudoterminal, it's different on each, and if you want to create a container, they don't even use the same concepts.

Re: Win16 Memory Management

#68
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.

> 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.

Many 6502 and Z80 systems used bank switching to support more than 64KB of memory. That way you could have 128KB or more physical RAM in a machine with an only 16-bit address bus. MP/M–the multitasking/multiuser version of CP/M–had support for this as a standard feature, since it was hard to fit multiple processes/users into only 64KB; it was ported to the single-user/single-tasking version in CP/M 3.0

Essentially, this was doing virtual memory, not inside the CPU, but in one or more external chips. Actually, back in the 70s and 80s, it wasn't uncommon for a memory management unit (MMU) to be a separate chip (or even PCB) rather than an integrated part of the CPU–for many systems it was an optional add-on if you needed more memory, or wanted to run more advanced operating systems.

Re: Win16 Memory Management

#69
post #63

Earlier quoted context omitted.

All software is portable by that former definition. When people talked about portable before, they meant code that used an abstraction that was platform agnostic. And that’s how it’s still used today. It’s just we have better abstractions now so our expectations of what is “portable” have gotten stricter. Eg the P in POSIX (which is nearly 40 years old now) is “portable”. The point of POSIX was to provide common abst…

It was about making software easier to port. You still couldn't necessarily just write software for all operating systems at once, but you had less porting work because less stuff was different because of the standardisation. So open(argv[1], O_RDONLY) works on all POSIX systems, but if you want to create a pseudoterminal, it's different on each, and if you want to create a container, they don't even use the same con…

> but if you want to create a pseudoterminal, it's different on each

This is somewhat outdated information. POSIX.1-2001 added "posix_openpt" to create a pseudoterminal, and most POSIX implementations now support it–at least Linux, macOS, FreeBSD, NetBSD, OpenBSD, Solaris, z/OS, AIX, HP-UX, QNX, Minix and Cygwin do. (Of course, that's only true of current versions, if you go back a decade or more you'll find many of them hadn't implemented it yet.)

Re: Win16 Memory Management

#70
post #62

Earlier quoted context omitted.

Just curious how do you teach kids BASIC. I’m sure my 6 year old won’t sit tight.

I usually start with game: guess the number. The computer generates a random number between 1 and 100. And you have to guess. When you’re too high, the computer says “too high” and likewise when you’re too low. It’s a great starter program because it teaches you strings (the output printed), integers, comparisons, conditionals, and iteration (you keep guessing until you get it right). And the whole thing only take ar…

Thanks! This is a good idea. I was thinking about typing games and such because he needs to learn words before doing anything useful, but guessing games are definitely fun, too. I can definitely write simple games using QBASIC (was preparing a Dospian on Rpi 4 as his 6 years old birthday gift).

Do you have any blog, or any recommendation of books to read for such topics? Maybe I can find some "Programming for kids" book back from the 90s. I find teaching kids in general very hard, much harder than teaching myself because kids don't have the cognitive capacity as an adult.

Post reply on HN