Hey, i'm trying to write a tiny program to boot from the floppy and print "hello world" on the screen. I've compiled the assembly to a .com file, and i've written a program to take that program and write 0x55 and 0xaa to bytes 510 and 510, then i use rawrite (a windows version i found) to write that 512 byte file to disk. I restart the computer, it reads the floppy then stops completely. Any idea whats going wrong? Here's the assemply code i use with fasm (the first free assembler i came across):
org 100h
mov ah, 9
mov dx, hello
int 21h
int 20h
loop1:
jmp loop1
hello db 'Hello world!$'
This is my first attempt at anything OS related, so anything would be appreciated.
Cheers,
Steve
Stupidly simple question
RE:Also...
Well...
Two suggestions:
1) org is a assembly command that sets the offset of the code section in an assembly file, in your case 100 hex. You probably want to set this to org 0
2) I don't know specifically about .com files, but most files add header crap at the beginning. You might try writing it out as a flat binary file and trying again.
Hope this helps
Two suggestions:
1) org is a assembly command that sets the offset of the code section in an assembly file, in your case 100 hex. You probably want to set this to org 0
2) I don't know specifically about .com files, but most files add header crap at the beginning. You might try writing it out as a flat binary file and trying again.
Hope this helps
RE:Stupidly simple question
You're trying to use int 21 and int 20, which are provided by DOS, which isn't loaded at this point. This is one fundamental point of OS development: You have to write everything yourself.
Hint: use int 10.
Hint: use int 10.
RE:Stupidly simple question
It's simple!
First INT 0x21 is a DOS INTERRUPT!!!!!!!!!!!! you should use INT 0X10
0x0E function (to write one charcter. You know, you will be obliged to execute a loop + LOADSB +CMP).
Second the boot sector is loaded into 0000:7c000 not at 0000:0100. That's why you should replace ORG 0x100 by ORG 0x7c00. And if you are using TASM+TLINK you will be obliged to use JLOC in the place of TASM.
First INT 0x21 is a DOS INTERRUPT!!!!!!!!!!!! you should use INT 0X10
0x0E function (to write one charcter. You know, you will be obliged to execute a loop + LOADSB +CMP).
Second the boot sector is loaded into 0000:7c000 not at 0000:0100. That's why you should replace ORG 0x100 by ORG 0x7c00. And if you are using TASM+TLINK you will be obliged to use JLOC in the place of TASM.
RE:Stupidly simple question
Quote from Mara: "the boot sector is loaded into 0000:7c000"
I think Mara intended to say that the boot sector is loaded at 0000:7C00 or 07C0:0000.
I think Mara intended to say that the boot sector is loaded at 0000:7C00 or 07C0:0000.
RE:Stupidly simple question
What you need to do is following in my belief
a. Use an assembler like NASM to produce flat binary, in which use ORG directive to set the offset to 7c00.
b. Use bios interrupts or write directly to screen memory, instead of using stupid DOS functions.
a. Use an assembler like NASM to produce flat binary, in which use ORG directive to set the offset to 7c00.
b. Use bios interrupts or write directly to screen memory, instead of using stupid DOS functions.
RE:Stupidly simple question
Thanks for all the help, i've got it working, i was being really blonde before :p
Cheers,
Steve
Cheers,
Steve