It's 1985, and if you're like me, you've spent the last few years squeezing every last byte out of the 640KB conventional memory limit. We’ve become experts at memory overlays and tight assembly loops just to keep our programs from crashing into the BIOS. But now, the Intel 80286 is hitting the mainstream, and it brings something called "Protected Mode."
Breaking the 1MB Barrier
The 8088/8086 could only address 1MB of RAM. That seemed like a lot when the IBM PC first came out, but as our compilers get more complex and our data sets grow, it’s becoming a straitjacket. The 286, however, can address up to 16MB.
The catch? To use that memory, you have to switch the processor into Protected Mode. In this mode, the way we handle memory addresses changes completely. Instead of direct segment:offset addressing (which we've all memorized by now), we use "selectors" that point to descriptors.
; In Real Mode, we did this:
mov ax, 0B800h
mov ds, ax
mov byte ptr [0], 'A' ; Write directly to video memory
; In Protected Mode, 0B800h is a selector, not a physical address.
The "Brain-Dead" Problem
While Protected Mode is a dream for multitasking and memory protection, there’s a huge problem: you can’t easily get back to Real Mode without resetting the CPU. IBM's AT uses a hardware trick involving the keyboard controller to trigger a reset just to switch back. It feels like a hack because it is.
For those of us writing DOS software, this means Protected Mode is a bit of a "walled garden." We can use it for huge data calculations, but we have to jump through hoops to use standard DOS interrupts (like INT 21h) which only run in Real Mode.
Looking Ahead
Despite its flaws, the 286 is the first real "adult" processor for the PC. It introduces the concept that the OS should protect itself from buggy applications. I suspect we’re going to be living with this segment-descriptor model for a long time, at least until Intel gives us a way to have a truly flat memory model. For now, I’m just happy I might finally have room for a decent-sized array.