Live data from Hacker News

8086 Segmented Memory was a good idea

owl.billpg.com

101–110 of 150 posts

Re: 8086 Segmented Memory was a good idea

#101
post #92

Earlier quoted context omitted.

But with only four segment registers, you couldn't treat it as that - not unless you only had four objects. So treating it as a sliding window was all you actually could do with it.

With 6-7 general purpose registers you could have; since anyway only three of them were usable for addressing you constantly had to load from memory. just use MOV ES instead of MOV BX to load a pointer and you actually got to increase your GPRs by one or two. Nobody did it except for larger memory areas which were allocated using farmalloc() or the INT 21h allocator.

x86 has 7 general purpose registers.

Using a bare segment register as a pointer was quite common. That’s what the DOS memory allocation call would return.

Re: 8086 Segmented Memory was a good idea

#102
post #89

Did anyone else find the AI written style of this offputting? The original 20 bit vision of the 8086 was when memory was very expensive and they expected typical high end machines to have 128K of memory. Intel’s assembler was designed so you could have up to 128K of code with a “shared” segment in the middle that either side could reach with near (16 bit only) pointers to call commonly shared routines, and more rarel…

Hi. I wrote it, and I'm a human. (Or at least I think I am.) I did use an AI for spell-checking, punctuation, generally making it flow, but its all my text. You think a machine is going to come up with "near pointers, far pointers, wherever-you-are pointers"?

Thanks for responding. The problem is:

- the “make it flow” made it flow in an AI generated way like short paragraphs that are one short sentence.

- I now have to decide if this is entirely AI generated and thus not worth my time reading or not.

- I would prefer to just interact with you as a real person; your writing doesn’t have to be perfect for what you write to be worth reading.

Re: 8086 Segmented Memory was a good idea

#103

I seem to recall at the time that flat memory was self evidently a better idea. It's not like people were sitting around going "gee I can't think of any better way to do memory addressing that this" until some genius suggests "how about flat?!?!?" Everyone knew flat was best but were stuck with 8086 crap.

Flat is not necessarily a better idea. In 1978, a 32 bit CPU would be stupidly expensive. The use case for > 64k was to simply have code and data split apart, and also have some MMIO, so basically 192k-256k of addressing needed.

Segmentation meant programs could remain essentially 16 bit with all the benefits to that like smaller code size.

Re: 8086 Segmented Memory was a good idea

#104

Nope. It was bad. It made computers in the 286/386 eras having RAM above 1MB sitting there and doing nothing. It took years to transit to DOS/4G and then finally 32bit OS Windows 95.

Ah, memories.

https://en.wikipedia.org/wiki/Expanded_memory

https://en.wikipedia.org/wiki/Extended_memory

https://en.wikipedia.org/wiki/Physical_Address_Extension

Re: 8086 Segmented Memory was a good idea

#105

I seem to recall at the time that flat memory was self evidently a better idea. It's not like people were sitting around going "gee I can't think of any better way to do memory addressing that this" until some genius suggests "how about flat?!?!?" Everyone knew flat was best but were stuck with 8086 crap.

I was drooling over the MC68000. I had a pre-release reference manual from 1979 and it was the most awesome chip around. Atari and Commodore and Apple used it after their 6502 systems. Arcade games used it after their 6502 and 6809 days. The only reason x86 became popular was because IBM put it in the PC - not for any technical reasons.

A 68k was roughly double the cost of an 8086, plus the additional cost for the rest of the supporting chips.

The PC was intended to be cheap and was competing with 8 bit machines. Being 16/20 bit made it already high end.

If you wanted 24 or 32 bit, IBM had many other machines to sell you. Or you could just buy a VAX.

Re: 8086 Segmented Memory was a good idea

#106
post #63
post #36

Earlier quoted context omitted.

Not entirely self-evidently. Position independent code was slower at the time and avoiding having to patching function addresses at load time is a net win. More importantly, there’s backwards compatibility. By the time the 8086 came out, people had spent serious money on getting binary-only software (WordStar cost hundreds of dollars, for example). “Buy this computer, and you can keep running the software you paid fo…

I wonder why couldn't Intel simply introduce single 'offset' register for apps ported from 8080, and make all other registers 20-24bit. Why bother with 4 different registers and all that segmentation nightmare?

Lots of benefits to a word size a power of 2.

Very few benefits to a clunky 24 or 20 bit word size; now it costs more and is a bizarre boutique architecture in a world where it needs to compete with 8 bit Z80s and 6502s.

Re: 8086 Segmented Memory was a good idea

#107

I seem to recall at the time that flat memory was self evidently a better idea. It's not like people were sitting around going "gee I can't think of any better way to do memory addressing that this" until some genius suggests "how about flat?!?!?" Everyone knew flat was best but were stuck with 8086 crap.

Personally I enjoyed writing assembly with segments. You can have 64k of code, 64k of data and 64k of stack without trying. So long as no individual data structure is larger than 64k there is no essential difficulty working with 16 bit pointers. When I think back I think it would be fun to have a hierarchical structure where composite data structures (think an array or hash map) are referred to with a pointer that go…

Lots of 8086 code was written that way. You’d use the segment register on paragraph alignment and basically take advantage of the This code was a nightmare to port to protected mode 80286 so it went away by the Windows 3.1 era.

Re: 8086 Segmented Memory was a good idea

#108

I seem to recall at the time that flat memory was self evidently a better idea. It's not like people were sitting around going "gee I can't think of any better way to do memory addressing that this" until some genius suggests "how about flat?!?!?" Everyone knew flat was best but were stuck with 8086 crap.

-- Everyone knew flat was best but were stuck with 8086 crap.-- This! Thats one of the most interesting things to me: Actually very often in the IT-world, the worst competitor won the race while better solutions were known and available: Microsoft, Intel etc. Esp. that MS won for decades while making mainly a very bad OS, though they have some good enterprise products. How would the world look, if Unix/BSD would have…

A PC with DOS was cheaper than a PC with Xenix, let alone a typical Unix machine. Also much easier to learn to use.

Macs also existed but were expensive. The PC with DOS was both powerful and cheap.

Re: 8086 Segmented Memory was a good idea

#109
post #76

Earlier quoted context omitted.

Except than later we returned to a sort-of segmented memory. That is of course paging, our programs allocates pages of memory that are a fixed size (4096 bytes) and are arranged in memory or in swap space how the OS decides. We just have the illusion of a "flat" memory model, but it's not really flat, the CPU and the operating system does an important job in translating our flat memory model in something that is not…

In turn though, the thinking needed to handle non-flat memory is a complexity that most programmers cannot handle - and even those who could probably should spend their brain power on the complex parts of their program not managing memory. Best to leave that hard part to a few experts instead of make everyone understand it. The above is very similar to the argument that you should use a garbage collected langauge.

Anyone writing an algorithm that needs to be high speed has to start thinking about caches and so forth. So it’s not exactly obsolete.

Back in 1980 most programs were being written in interpreted languages that did all the hard work of memory for you - just like today.

Re: 8086 Segmented Memory was a good idea

#110
post #97

Earlier quoted context omitted.

"generally make it flow" is exactly the problem. It's a process of smoothing over any interesting features of the text to replace them with plastic. It's submerging the actual information you wish to convey under a layer of low-entropy noise. The whole signal may still be there, but having to find it under a uniform glossy finish is work for the reader. It's work you didn't need to delegate to the reader. LLMs genera…

> As a person who's been participating in human-to-human communication your entire life, you probably have a pretty well-developed sense of how to structure the flow of a piece of communication. Not OP, but this is where you're wrong. The vast majority of people, myself included, have difficulty structuring communication for effectiveness to a wide audience. When I manage to pull it off I'm very proud of the work, bu…

He's not writing the bible. He's writing a blog post about segment registers. It's fine if there's a sharp edge here or there. You're probably better at communication than you think, and your readers are probably less picky than you're imagining. An occasional sharp edge in your text is not the end of the world.
Post reply on HN