Page 1 of 1

Real mode print function not working!

Posted: Tue Jun 21, 2005 4:36 pm
by Jubbens
I'm trying to print simple progress messages from my boot loader. But when I run the attatched bootloader, all it prints is

????????????????????????????????????????????????????????????????????????????????
????????????????????????????????????????????????????????????????????????????????
????????????????????????????????????????????????????????????????????????????????
????????????????????????????????????????????????????????????????????????????????
????????????????????????????????????????????????????????????????????????????????
????????????????????????????????????????????????????????????????????????????????
????????????????????????????????

Very strange indeed. Any insights?

Re:Real mode print function not working!

Posted: Tue Jun 21, 2005 4:47 pm
by Ushma
Whilst I don't know that this is causing your problem, you seem to be making assumptions about the status of the segment registers. Get them into a known state before you do anything else. Also, you don't seem to be setting up a stack. You should do so.

Re:Real mode print function not working!

Posted: Tue Jun 21, 2005 5:03 pm
by Jubbens
Set regs and moved the setting up of the stack to the bootstrap. No change.

???

Re:Real mode print function not working!

Posted: Tue Jun 21, 2005 6:55 pm
by Brendan
Hi,

It could be because of this:

Code: Select all

   mov si,[msg1]
I'd assume you'd want this instead:

Code: Select all

   mov si,msg1
While it's probably not a problem, I'd also use a "CLD" instruction somewhere - you never know when someone's gone and reversed the direction.

I've also heard of BIOSs that refuse to boot when the first instruction of the boot image isn't a "jmp" (a Compaq IIRC).


Cheers,

Brendan

Re:Real mode print function not working!

Posted: Tue Jun 21, 2005 7:03 pm
by Jubbens
Thanks Brendan, the square brackets were the problem.

You're awesome.