4 ms·
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 anyw
by pjc50 10y ago
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=41713 https://blogs.msdn.microsoft.com/oldnewthing/20031125-00/?p=...
- userbinator 10y agoI 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_ptrs.htm http://www.keil.com/support/man/docs/c51/c51_le_ptrconversions.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.
- svens_ 10y agoAs 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.
- vt240 10y agoYes, there is nothing more fun than moving a large 8051 embedded project from Keil to Tasking.
- mjevans 10y agoRISC-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?
- svens_ 10y agoYes, 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.
- _0ffh 10y agoSo, does the boot sector load to 0000:7C00 or to 07C0:0000 or to 03A0:4200, or what? :)
- pjc50 10y agohttp://wiki.osdev.org/MBR_%28x86%29 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."
- _0ffh 10y agoYeah, 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.]