Page 1 of 1

Boot problems with VMware Fusion

Posted: Sat Feb 01, 2014 10:23 am
by Codeman1980
Hello,

I have written a very simple boot sector, that dumps out 3 characters as a welcome message on the screen:

[org 0x7c00]

jmp 0x0000:start
start:

mov ah, 0x0e
mov al, [welcome_message]
int 0x10

mov al, [welcome_message + 1]
int 0x10

mov al, [welcome_message + 2]
int 0x10

jmp $

welcome_message:
db '123'

; Boot Sector Padding
times 510-($-$$) db 0
dw 0xaa55

When I'm compiling the code with nasm.exe to a flat binary, and running the boot sector in Bochs everything is fine and as expected.

Afterwards I have also converted the boot sector to an ISO file (with MagicISO).
I can also boot that generated ISO without any problems from VMware Fusion.
But as soon as I reference a memory location (like mov al, [welcome_message]), it seems that I'm not accessing the correct memory location, because nothing is shown on the screen (or some garbage data).
When I'm executing some like mov al, 'X', then making a int 0x10, the character "X" is shown on the screen.
So the above mentioned problem only occurs, when I'm trying to access specific memory locations.

Any ideas on that?

Thanks & nice greetings

-Klaus

Re: Boot problems with VMware Fusion

Posted: Sat Feb 01, 2014 10:45 am
by Antti
Welcome to the OSDev.org forum! You have to set segment registers. You can not assume the ds register is zero and you should also set the stack before doing anything.
http://www.ctyme.com/intr/rb-0106.htm wrote: VIDEO - TELETYPE OUTPUT

AH = 0Eh
AL = character to write
BH = page number
BL = foreground color (graphics modes only)

Re: Boot problems with VMware Fusion

Posted: Sat Feb 01, 2014 10:57 am
by Codeman1980
Hello Antti,

Thanks for your fast answer.
And yes, you were right: I have now initialized the ds register with 0, and now the boot sector also works in VMware Fusion :-)

Thanks!

-Klaus

Re: Boot problems with VMware Fusion

Posted: Sun Feb 02, 2014 4:47 am
by Bender
Welcome to OSDev 8)
As a side note please use code tags.
Which work like this :

Code: Select all

[code]
Code code code
Code code code 
[/code]
VIDEO - TELETYPE OUTPUT

AH = 0Eh
AL = character to write
BH = page number
BL = foreground color (graphics modes only)
Is page number important? My BIOS calls never set the page number, they still work. (Bochs/Qemu) :shock:

Re: Boot problems with VMware Fusion

Posted: Sun Feb 02, 2014 5:30 am
by Brendan
Hi,
Bender wrote:Is page number important? My BIOS calls never set the page number, they still work. (Bochs/Qemu) :shock:
Yes.

For text mode (e.g. 80*25) it costs 4000 bytes for the entire screen. For a (very obsolete) VGA card there's 256 KiB of display memory; which means there's enough memory for about 64 screens of information (actually a bit less due to font data storage, but you get what I mean).

To take advantage of this spare display memory, you have "display pages". For example, you can be displaying "display page 0" while writing/creating data in "display page 1", and then switch to "display page 0" when you're finished. You can also have (e.g.) virtual terminals, with a different display page for each virtual terminal so that you can switch between them very quickly. Of course more modern video cards have more display memory (and could support more display pages than VGA did).

If you never set the display page properly, then your code is very broken; and possibly you have been unlucky (e.g. BH happens to be zero by accident, or the specific video card isn't 100% VGA compatible, so you've been unlucky enough not to notice that your code is broken).


Cheers,

Brendan