OSDev.org

The Place to Start for Operating System Developers
It is currently Thu Mar 28, 2024 10:40 am

All times are UTC - 6 hours




Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: Simple bootloader doesn't work on any physical machine.
PostPosted: Sun Apr 23, 2023 3:13 am 
Offline

Joined: Sun Apr 23, 2023 3:02 am
Posts: 1
I've tried it using QEMU as well as VirtualBox, it works without any issues.

Now, I've tried a multitude of ways for writing the bootloader to a USB memory stick and booting up a physical machine to display "FeadowOS", nothing works. I've been trying for 8 hours or so.. I've tried different combinations of search keywords, I've asked chatGPT, I've looked in this website, both in the main section and the forums. I've tried on 2 different laptops. I made sure to enable "Legacy Booting" whenever possible. Nothing works. Please advise. I'm an absolute beginner.

Here's the code for the bootloader before assembly:

Code:
mov ah, 0x0e
mov al, 'F'
int 0x10
mov ah, 0x0e
mov al, 'e'
int 0x10
mov ah, 0x0e
mov al, 'a'
int 0x10
mov ah, 0x0e
mov al, 'd'
int 0x10
mov ah, 0x0e
mov al, 'o'
int 0x10
mov ah, 0x0e
mov al, 'w'
int 0x10
mov ah, 0x0e
mov al, 'O'
int 0x10
mov ah, 0x0e
mov al, 'S'
int 0x10

jmp $

times 510-($-$$) db 0
db 0x55, 0xaa


Top
 Profile  
 
 Post subject: Re: Simple bootloader doesn't work on any physical machine.
PostPosted: Sun May 07, 2023 1:05 pm 
Offline
Member
Member

Joined: Wed Aug 30, 2017 8:24 am
Posts: 1593
Depending on the system, it may try to emulate a floppy when booting from USB stick. And floppies have a BIOS Parameter Block at the start. Don't recall how long it is, so why don't you add a skip to byte 128 to your bootsector?
Code:
jmp start
times 128-($-$$) db 90h
start:
[rest of the code here]
If that works then part of the start of your bootsector gets overwritten. Or else the BIOS also verifies that the boot sector starts with a jmp opcode.

Otherwise I don't really know. I mean, yes, you are not setting up a stack, but the BIOS must have set up a stack that does not interfere with the boot sector area at least when you are doing these simple calls, since BIOS loaded a sector to the right place. You can add that part, it doesn't hurt:
Code:
xor ax, ax
mov ss, ax
mov sp, 7c00h
That sets up the stack to start below the boot sector itself, so now it definitely won't interfere with the code.

_________________
Carpe diem!


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: Bing [Bot] and 67 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group