flat assembler
Message board for the users of flat assembler.

Index > OS Construction > simple realmode OS

Author
Thread Post new topic Reply to topic
adefeo



Joined: 12 Jan 2004
Posts: 46
Location: Bellmore, Long Island, New York
adefeo 28 Apr 2004, 19:37
I am trying to write a simple realmode OS that prints a string to the screen and halts. The code below is what I have, but it doesn't work. What's wrong???


Code:
;BOOT.ASM
;Quick86/OpratingSystem BootLoader 0.01
;This file is licensed under the
;GNU General Public License version 2 or later
use16

start:
mov ax, 0x07C0
mov ss, ax
mov bp, 0          
mov sp, 0      
mov ds, ax     
mov ax, 0x07E0 
mov es, ax
jmp loadkern

loadkern:
mov ah, 0x02
mov al, 0x02
mov ch, 0x02
mov cl, 0x02
mov dh, 0x00
mov dl, 0x00
mov bx, 0x1000
mov es, bx
mov bx, 0x0000

mov ax, 0x1000
mov ds, ax

jmp 0x1000:0x0000

times 512-($-start)-2 db 0
dw 0xAA55
    



And this is the Kernel:
Code:
mov si, msg
call print
call hang

print:
mov ah, 0x0E
mov bh, 0x07
mov bl, 0x09
nextchar:
lodsb
cmp al, 0
je return
int 0x10
jmp nextchar
return:
ret

hang:
jmp hang

msg db 'Quick86/OS 0.01 (build COCO)',13,10,0
    


What's wrong???
Post 28 Apr 2004, 19:37
View user's profile Send private message Visit poster's website AIM Address Reply with quote
roticv



Joined: 19 Jun 2003
Posts: 374
Location: Singapore
roticv 29 Apr 2004, 12:19
I think it is because the kernel is not loaded to the memory. Anyway you are booting from what?
Post 29 Apr 2004, 12:19
View user's profile Send private message Visit poster's website MSN Messenger Reply with quote
adefeo



Joined: 12 Jan 2004
Posts: 46
Location: Bellmore, Long Island, New York
adefeo 29 Apr 2004, 15:54
I'm an idiot! I forgot to call INT 13!!!

BTW I am loading from floppy disk

Thanks!!! Very Happy Very Happy Very Happy
Post 29 Apr 2004, 15:54
View user's profile Send private message Visit poster's website AIM Address Reply with quote
roticv



Joined: 19 Jun 2003
Posts: 374
Location: Singapore
roticv 29 Apr 2004, 16:36
Just when I was wondering why you are setting the values in the registers and not doing anything. Glad to be of help.
Post 29 Apr 2004, 16:36
View user's profile Send private message Visit poster's website MSN Messenger Reply with quote
Carlito



Joined: 08 Apr 2004
Posts: 11
Location: Paris
Carlito 19 May 2004, 08:46
I'm writing my own boot sector, would you please post your code if functionnal. Thanks
Post 19 May 2004, 08:46
View user's profile Send private message Visit poster's website MSN Messenger ICQ Number Reply with quote
adefeo



Joined: 12 Jan 2004
Posts: 46
Location: Bellmore, Long Island, New York
adefeo 19 May 2004, 18:58
Code:
use16 

start: 
mov ax, 0x07C0 
mov ss, ax 
mov bp, 0          
mov sp, 0      
mov ds, ax      
mov ax, 0x07E0 
mov es, ax 
jmp loadkern 

loadkern: 
mov ah, 0x02 
mov al, 0x02 
mov ch, 0x02 
mov cl, 0x02 
mov dh, 0x00 
mov dl, 0x00 
mov bx, 0x1000 
mov es, bx 
mov bx, 0x0000 

mov ax, 0x1000 
mov ds, ax 

jmp 0x1000:0x0000 

times 512-($-start)-2 db 0 
dw 0xAA55
    


This should be functional to load 2 sectors.
Post 19 May 2004, 18:58
View user's profile Send private message Visit poster's website AIM Address 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.