Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Another platform that doesn't have straightforward pointers: x86. 16-bit mode. Because of the segmentation system, if you wanted a fully general pointer to anywhere in the address space ("far") it had to be split into two registers. Greater speed could be achieved with "near" pointers, but only within a 64k segment. You could also very easily have non-identical pointers that pointed to the same memory location.

Fragments of this mess survive in the Windows API, like Shelley's "vast and trunkless legs of stone": https://blogs.msdn.microsoft.com/oldnewthing/20031125-00/?p=...



I think the 8051 is more interesting - it's a Harvard architecture with at least 3 separate address spaces:

http://www.keil.com/support/man/docs/c51/c51_le_ptrs.htm

http://www.keil.com/support/man/docs/c51/c51_le_ptrconversio...

Just like x86, it's likely that everyone interacts daily with a system containing at least 1 8051 core.


As someone who did a lot of embedded development, I wouldn't exactly call it "more interesting". More like "that shit needs to die already".

The biggest problem with those is, that modern compilers don't support it. Well, that is open-source compilers. IAR will happily sell you a license of their IDE for 2.4k$/seat. There is sdcc, but it's no comparison to a modern gcc or the commercial offerings.

Unfortunately you're right though, 8051 processors are cheap and abundant. Chip makers use it as the go to architecture for any simple embedded processing requirements. It's slowly changing though, but ARM licensing costs are still much higher. Let's hope that in a decade or so they'll use RISC-V instead.


RISC-V is indeed what I thought, but hasn't MIPS also been free (enough) and open for at least a decade? You'd think that on licencing alone that'd be enough for a replacement in new products.

Edit: I am mistaken, it seems that though MIPS is used in all sorts of things that I'd expect wanted the cheapest possible CPU core it has only become free for academic use. I wonder how common that mis-conception is for those not active in the space?


Yes, MIPS is a cheap candidate for when you need a bit more computing power than just a microcontroller.

Home routers usually have MIPS CPUs and run Linux on top of it. This wouldn't be possible with the 8051.


Yes, there is nothing more fun than moving a large 8051 embedded project from Keil to Tasking.


So, does the boot sector load to 0000:7C00 or to 07C0:0000 or to 03A0:4200, or what? :)


http://wiki.osdev.org/MBR_%28x86%29

"This is usually 0x0000:0x7c00 (CS = 0, offset address 0x7c00). However, some BIOSes load to 0x7c0:0x0000 (CS = 0x07c0, offset address 0) -- which resolves to the same physical address, but can cause problems."


Yeah, I encountered the problem when writing a bootloader, that's why I brought it up! :)

Don't rely on the BIOS' values. You can for example use a far jump to reset CS:IP if you rely on them having specific values.

[Edit: Or, maybe better, just don't rely on them.]




Consider applying for YC's Fall 2026 batch! Applications are open till July 27.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: