Now, I'm not that experienced in linux (main dev environment is cygwin on windows), but there are a few problems in what you're doing...
Since you're on linux, I'm presuming you're compiling it to ELF (since there's no compiler flag saying otherwise). Correct me if I'm wrong, but does ELF (or if it does, then GAS) support 16-bit relocation? Maybe try flat binary instead... (but it all depends on how you plan to run this program in real mode)
I don't think -nostdlib is enough to prevent linking other unwanted (not to mention 32-bit) stuff in when compiling to real mode...
Code: Select all
.global _start
_start:
.code16
movw $ok_msg, %ax /* <=== WHY THIS CAUSES A BUG? */
ret
Maybe putting the ".code16" thing at the beginning could help...
And don't forget that once you fix this issue, real mode segment addressing and offsets can mess up everything (since you're not running at 0x0000:0x0000 unless in V86 mode, i think)
Good luck
Julian