"Hello world" bootstrap works only on 2 of 3 PCs
Posted: Wed Jul 27, 2016 11:28 pm
Hello! Maybe one of you has an idea why my bootstrap code works only on 2 of 3 PCs I've tested it on. On two of them, "Hello, world!" is printed, as I would expect, but on the third one, nothing is printed.
I've already tested the most simple bootstrap ever, namely just "int 0x10" with AX=0x0E21 and BX=0x0007. This worked on all PCs.
This is the assembler code of my bootloader, which works only on 2 of 3 PCs. What am I doing wrong? Maybe a race condition with some handler or some register not set properly? (My final aim is not to write a "hello world" bootstrap code, but something more complex for this one PC where it is not working. So I need to understand the issue and not just to make this "hello world" here working.) Thanks for your help?
Below, I also attach the corresponding 512 bytes if anyone has the suspition that I translated something wrong:
I've already tested the most simple bootstrap ever, namely just "int 0x10" with AX=0x0E21 and BX=0x0007. This worked on all PCs.
This is the assembler code of my bootloader, which works only on 2 of 3 PCs. What am I doing wrong? Maybe a race condition with some handler or some register not set properly? (My final aim is not to write a "hello world" bootstrap code, but something more complex for this one PC where it is not working. So I need to understand the issue and not just to make this "hello world" here working.) Thanks for your help?
Code: Select all
cli
xor ax, ax
mov es, ax
mov ss, ax
mov ds, ax
mov fs, ax
mov gs, ax
mov sp, ax
sti
push hello ; this is the address (0x7C34) which points to the string location
call print_string
hang:
jmp hang
print_string:
push bp
mov bp, sp
loop:
mov bx, [bp + 4]
mov al, [bx]
test al, al
jz break
mov ah, 0x0E
mov bx, 0x0007
push bp ; I've read that some BIOSes have the bug to change bp after interrupt 0x10
int 0x10
pop bp
inc [bp + 4]
jmp loop
break:
pop bp
ret
Code: Select all
FA 33 C0 8E C0 8E D0 8E D8 8E E0 8E E8 89 C4 FB 68 34 7C E8 02 00 EB FE 55 89 E5 8B 5E 04 8A 07 84 C0 74 0E B4 0E BB 07 00 55 CD 10 5D FF 46 04 EB E9 5D C3 48 65 6C 6C 6F 2C 20 77 6F 72 6C 64 21 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 55 AA