I've been messing around with trying to make a few trivial programs that can run without an OS, just for the fun of it. I want to make a full-fledged OS sometime, and I'm just trying to get the feel for how things are done. Anyway, I wrote a simple program with NASM under dos that simply echoes back to you whatever you type. I ran it under DOS to test, and it works exactly how I want it to. Once I knew it worked, I wrote a simple program to load my "echo" code when the computer starts up. Now, my loader program definitely works on startup, as I have made it show me a simple message saying that it was loaded. The problem is that it doesn't load my echo program.
Now, I used debug to save my echo program to sector 5 of a floppy disk. This is the command I gave:
Just to make sure I also did this:
I put my bootloader at the first sector, as I was supposed to using the same method. Here's the code in my loader that I'm using to load my code:
mov ax, 0x0201
mov cx, 0x0005
xor dx, dx
mov bx, 0x5000
mov es, bx
mov bx, 0x100
int 0x13
jmp 0x5000:0x100
All that is supposed to do is load the code from the fifth sector of my floppy disk to addred 0x5000:0x100. It's not doing that. I have no idea why. Have I written the jmp command incorrectly? I know for a fact that my code is there in the fifth sector of the floppy, as I checked with debug. Is there something I'm supposed to add in my echo program to allow it to act as a standalone program that I don't need in dos? Perhaps I need to set some segment registers or something? Could anyone help me out with what I'm doing wrong? Thanks for your time and any help I recieve.