I have a very simple program that I’ve written using FASM that attempts to simply print out a string from inside the boot sector of an emulated x86 chip via qemu. I am attempting to print out a basic startup string. I can get the emulator to boot from the virtual hard disk and print out individual characters if I specify them by hand by moving a specific ascii value into the
al register, but it will not execute passed a
dw command. Here is the current code I have:
mov ah,0x0e ;int 10/ah = 0eh -> scrolling teletype BIOS routine prepare db "Preparing to Launch..." lea ebx,(prepare) print1: mov al, (ebx) int 0x10 inc cl cmp cl, 22 jle print1 times 510 -( $ - $$ ) db 0 ;Pad the boot sector out with zeros dw 0xaa55
The code appears to be compiling perfectly fine, as when I look at the hex values of the harddisk, it places the
0xaa55 in the proper location. Furthermore, if I place a simple interrupt statement around the
db command, so that it looks like this:
mov al, 76 int 0x10 prepare db "Preparing to Launch..." mov al, 76 int 0x10
the second interrupt will never be executed. I have tried moving the
prepare db "Preparing to Launch..." line throughout the code, in which case it will compile without fail, but will print a series of 19 capital S’s as opposed to the actual string.
To simplify, the output I’m getting if
prepare db "Preparing..." is near the top of my code looks like this:
Booting from Hard Disk...
If that line of code is at the bottom, then it looks like this:
Booting from Hard Disk... SSSSSSSSSSSSSSSSSSSSSS
But I want it to look like this:
Booting from Hard Disk... Preparing to Launch...