flat assembler
Message board for the users of flat assembler.

Index > OS Construction > Booting Issue!

Author
Thread Post new topic Reply to topic
rhyno_dagreat



Joined: 31 Jul 2006
Posts: 487
Location: Maryland, Unol Daleithiau
rhyno_dagreat 31 Jul 2006, 16:20
Hello! I just started using FASM and in my humble opinion, it rocks! I find it more appealing than NASM and other assemblers for some odd reason. Razz

But anyways, back to the issue at hand...
I just decided I was gonna try to write an OS in ASM, and right now I'm working on the bootsector and trying to load up another sector right after it. Now so far the bootsector program loads up, but it doesn't load the second sector into memory. I was hoping someone could help me here.

This is the loader itself...

Code:
;BOOTSTART
org 7C00h

message db 'Loading RhynOS...',13,10,0

start:
        xor ax, ax
        mov ds, ax

        mov si, message
        call bios_print

load_os:
        mov ax, 0060h
        mov es, ax
        mov bx, 0000h
        mov ah, 02h
        mov al, 1
        mov ch, 0
        mov cl, 2
        mov dh, 0
        mov dl, 0
        int 13h
        jmp 0060h:0000h

bios_print:
        lodsb
        or al, al
        jz done
        mov ah, 0x0E
        int 0x10
        jmp bios_print

done:
        call load_os

;BOOTEND
        times 510-($-$$) db 0
        dw 0xAA55         
    


And this is what it's loading...

Code:
org 0000h
use16

welcome db 'Welcome to RhynOS!', 13, 10, 0

start:
        mov ax, 0060h
        mov ds, ax
        mov si, welcome

ch_loop:
        lodsb
        or al, al
        jz return
        mov ah, 0x0E
        int 0x10
        jmp ch_loop

return:
        ret


        times 512-($-$$) db 0                      
    


Some input/help would be greatly appreciated! Thanks!

P.S. - This is the first time I've really used int 13h, and I might be doing something wrong with that, so could someone give me a good explaination on it? I've looked at Ralph Brown's Interrupt list, and it didn't help much.

Thanks!

-Rhyno
Post 31 Jul 2006, 16:20
View user's profile Send private message Reply with quote
zhak



Joined: 12 Apr 2005
Posts: 501
Location: Belarus
zhak 31 Jul 2006, 21:25
first of all, you should place your message after code, or issue jmp start command before it, because BIOS redirects execution flow on 0:7C00 and your text is interpreted as commands and executed. that's why nothing works.
also, it's better to use BIOS Drive Number that is returned by BIOS in DL register when you call INT 13h, but not set it hardcoded as you've done (mov dl, 0).
Post 31 Jul 2006, 21:25
View user's profile Send private message Reply with quote
rhyno_dagreat



Joined: 31 Jul 2006
Posts: 487
Location: Maryland, Unol Daleithiau
rhyno_dagreat 31 Jul 2006, 23:10
Thanks zhak! That did it! And it was something so trivial... Anyways, I'm wondering about what you just said about the BIOS returning the drive number? How does it do that, if you don't mind my asking?
Post 31 Jul 2006, 23:10
View user's profile Send private message Reply with quote
Kenneth



Joined: 16 Nov 2005
Posts: 38
Location: United States of America
Kenneth 01 Aug 2006, 00:37
When it starts up the drive number is already in dl.
Post 01 Aug 2006, 00:37
View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger ICQ Number Reply with quote
rhyno_dagreat



Joined: 31 Jul 2006
Posts: 487
Location: Maryland, Unol Daleithiau
rhyno_dagreat 01 Aug 2006, 02:53
Ah... I see... thanks! BTW... I recall a while ago there was a bunch of FASM programming tutorials out there... does anyone know any weblinks to them?
Post 01 Aug 2006, 02:53
View user's profile Send private message Reply with quote
zhak



Joined: 12 Apr 2005
Posts: 501
Location: Belarus
zhak 01 Aug 2006, 10:43
http://www.phoenix.com/NR/rdonlyres/56E38DE2-3E6F-4743-835F-B4A53726ABED/0/specsbbs101.pdf
This is BIOS Boot Specification. Take a look at this document. It's useful for a boot loader writer.
Post 01 Aug 2006, 10:43
View user's profile Send private message Reply with quote
rhyno_dagreat



Joined: 31 Jul 2006
Posts: 487
Location: Maryland, Unol Daleithiau
rhyno_dagreat 01 Aug 2006, 18:34
Thanks!
Post 01 Aug 2006, 18:34
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
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 vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.