flicki wrote:
I feel really dumb for posting this, but anyway.
I have made a bootloader and it works on QEMU, VirtualBox and Bochs, but not on VMware. I have done some debugging and
narrowed it down to int 0x13 ah = 0x42. Now if I change it to ah=2, it works! While this may seem to be the obvious solution,
I have already written a stage 2 using the extended bios functions.
Cut it short my question is; has anyone else had trouble with int 0x13 ah = 0x42 in VMware and what was your/their fix.
It's no use guessing (as the other respondents, even if they are right, are doing). Here is a simple (probably too simple for most)
boot program (FASM/NASM) which prints the relevant register values on startup.
Code:
org 0x7C00
start:
push sp
push 0xBEEF
push ss
push es
push ds
push cs
push 0xFEED
pushf
xor ax, ax
mov ds, ax
mov es, ax
mov cx, 7
mov si, strings
call print
pop ax
call print_binary
call print_return
.1:
call print
pop ax
call print_hex
call print_return
loop .1
jmp $
print:
cld
.1:
mov ah, 0x0E
xor bh, bh
lodsb
test al, al
je .2
int 0x10
jmp .1
.2:
ret
print_hex:
push cx
mov dx, ax
mov ah, 0Eh
xor bx, bx
mov cx, 4
.1:
rol dx, 4
mov al, dl
and al, 0Fh
add al, '0'
cmp al, '9'
jbe .2
add al, 'A'-('9'+1)
.2:
int 10h
loop .1
pop cx
ret
print_binary:
push cx
mov dx, ax
mov ah, 0Eh
xor bx, bx
mov cx, 16
.1:
rol dx, 1
mov al, dl
and al, 1
add al, '0'
int 10h
loop .1
pop cx
ret
print_return:
mov ah, 0Eh
xor bx, bx
mov al, 0x0D
int 10h
mov al, 0x0A
int 10h
ret
strings:
db "FLAGS = ", 0
db "FEED = ", 0
db "CS = 0x", 0
db "DS = 0x", 0
db "ES = 0x", 0
db "SS = 0x", 0
db "BEEF = ", 0
db "SP = 0x", 0
times 510 - ($-$$) db 0
dw 0xAA55
Attachment:
qemu.png [ 14.41 KiB | Viewed 3899 times ]
Attachment:
VMware.png [ 74.18 KiB | Viewed 3899 times ]
The main difference is the
DS value, which VMware has left at the BDA segment value and not zero which it needs to be set to for
an
org 0x7c00.
So, it seems that assuming a
DS value was the issue here. Of course neither
int 0x13 should have worked with an incorrect
DL value,
so it's more than likely not the only issue here.
Remember, when you
ASSUME you make an
ASS out of yo
U and other forum
MEmbers.