I am working on an OS in NASM and I am a newbie so therefore I have run into a problem. It's hard to explain because I dont know whats wrong so I will put the code here.
Both the bootloader part and the kernel are put together in one file with this code:
Code: Select all
; Drummer disk image
%include 'drummer.asm'
%include 'drummker.asm'
Code: Select all
; Drummer bootstrap
[ORG 0]
jmp 07C0h:start
; DATA
msg db 'Wellcome to Drummer 0.0.1',13,10,0
msg2 db 'This is a simple OS I made for learning purpouses.',13,10,'To Find out more, type info in the kernels commandprompt.',13,10,13,10,0
msg3 db 'Loading the kernel...',13,10,0
err db 'NO! An error occured! DAMN!',0
message: ; Dump ds:si to screen.
lodsb
cmp al, 0
je done
mov ah, 0Eh
mov bx, 7
int 10h
jmp message
done:
ret
start:
mov ax, cs
mov ds, ax
mov es, ax
mov si, msg
call message
mov si, msg2
call message
mov si, msg3
call message
load: ; Load the Kernel!
mov ax, 1000h
mov es, ax
mov bx, 0
mov ah, 2 ; Load disk data to ES:BX
mov al, 5 ; Load 5 sectors
mov ch, 0 ; Cylinder=0
mov cl, 2 ; Sector=2
mov dh, 0 ; Head=0
mov dl, 0 ; Drive=0
int 13h ; Read!
jc error ; On error display an error message
jmp 1000h:0000 ; Jump to the kernel
error:
mov si, err
call message
hang1:
jmp hang1
times 510-($-$$) db 0
dw 0AA55h
Code: Select all
jmp kernel
; Kernel Data
welcome db 'Kernel Loaded OK! Have a nice day!',13,10,0
prompt db 'Drummer:',0
message2: ; Dump ds:si to screen.
lodsb
cmp al, 0
je done2
mov ah, 0Eh
mov bx, 7
int 10h
jmp message2
done2:
ret
kernel:
mov ax, 1000h
mov ds, ax
mov es, ax
mov si, prompt ; This won't work.... I don't know why!
call message2 ; <<---------------------------------<<
mov ah, 9 ; print "===="
mov al, '=' ;
mov bx, 7 ;
mov cx, 4 ;
int 10h ;
hang:
jmp hang
//Martin Hult?n Ashauer