Boot problems with VMware Fusion

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
Codeman1980
Posts: 8
Joined: Sat Feb 01, 2014 10:15 am

Boot problems with VMware Fusion

Post 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
Antti
Member
Member
Posts: 923
Joined: Thu Jul 05, 2012 5:12 am
Location: Finland

Re: Boot problems with VMware Fusion

Post 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)
Codeman1980
Posts: 8
Joined: Sat Feb 01, 2014 10:15 am

Re: Boot problems with VMware Fusion

Post 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
User avatar
Bender
Member
Member
Posts: 449
Joined: Wed Aug 21, 2013 3:53 am
Libera.chat IRC: bender|
Location: Asia, Singapore

Re: Boot problems with VMware Fusion

Post 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:
"In a time of universal deceit - telling the truth is a revolutionary act." -- George Orwell
(R3X Runtime VM)(CHIP8 Interpreter OS)
User avatar
Brendan
Member
Member
Posts: 8561
Joined: Sat Jan 15, 2005 12:00 am
Location: At his keyboard!
Contact:

Re: Boot problems with VMware Fusion

Post 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
For all things; perfection is, and will always remain, impossible to achieve in practice. However; by striving for perfection we create things that are as perfect as practically possible. Let the pursuit of perfection be our guide.
Post Reply