I’ve been working through the tutorials on this webpage which progressively creates a bootloader that displays Hello World.
The 2nd tutorial (where we attempt to get an “A” to be output) works perfectly, and yet the 1st tutorial doesn’t work for me at all! (The BIOS completely ignores the floppy disk and boots straight into Windows). This is less of an issue, although any explanations would be appreciated.
The real problem is that I can’t get the 3rd tutorial to work. Instead on outputting “Hello World”, I get an unusual character (and blinking cursor) in the bottom-left corner of the screen. It looks a bit like a smiley face inside a rounded rectangle. Does anyone know how to get Hello World to display as it should?
You say “boot straight into windows” so I assume you are using a physical PC. Future note to make: Always use an emulator for development! It’s just easier. I like Bochs for OSDeving cause it has nice debugging features. Now, onto the possible solution.
There are a lot of buggy BIOSes that break the informal specifications of the IBM PC for the 0x7C00 load address.
This can give a lot of problems with memory addresses and such whenever you are assembling. So make the beginning look like this:
See, some load at
0x07C0:0000and most load(and its considered proper to) at0x0000:7C00. It is the same flat address, but the different segment settings can really screw up absolute memory addresses. So let’s remove the “magic” of the assembler and see what it looks like (note I don’t guarantee addresses to be completely correct with this. I don’t know the size of all opcodes)So, we jump to an absolute address.
Now then. What happens when we don’t do this?
take this program for example:
This disassembles to something like
Oh, well it uses absolute addressing, so how could that go wrong? Well, what if DS is actually
0x7C0? then instead of getting the assembler expected0:0x7C06it will get0x7C0:0x7C06which are not the same flat address.I hope this helps you to understand. It’s really a complicated topic though and takes a while of low level programming to fully understand.