News for hackers. Stuff that matters.
Re:Show HN: A simple way to write standalone C programs for ... by jacobush on Wednesday October 02, 2019 @10:29AM (#21136822)
This is so insane, I had no idea such a thing was possible:

16 vs 32 bit It is possible to use 32-bit instructions in the real-address mode, they just need to be marked with address-size and operand-size prefixes. The -m16 option for clang/gcc, and .code16 directive in GNU assembler, do exactly that. The resulting code is 32-bit, only marked everywhere with those prefixes. It's not compatible with actual 16-bit CPUs.

"Unfortunately the 32-bit addresses still cannot exceed the boundary of the segment (65535), otherwise they'll trigger an exception. QEMU doesn't emulate this behaviour, so it's useful to occasionally test with Bochs."

There are no comments on this comment yet.