So simple, yet freaking
Posted: Fri Aug 04, 2006 6:11 am
Hi all,
i'm just trying to print a string in real mode. Everythings fine when my kernel is only one sector. Now, i tried to do the same thing by loading a sector of disk into memory. Well, nothing happens, the string does not appear , only a flashing cursor
here's my code
kernelt.asm
proto2.inc
the bootloader, boot.asm
and i use and image file to combine these files, image02.asm
i compile
nasm -f bin image02.asm -o image.bin
and
dd if=image.bin of=/dev/fd0
I'd really appreciate any help cause it's so simple and it's not working
Thank you
i'm just trying to print a string in real mode. Everythings fine when my kernel is only one sector. Now, i tried to do the same thing by loading a sector of disk into memory. Well, nothing happens, the string does not appear , only a flashing cursor
here's my code
kernelt.asm
Code: Select all
[BITS 16]
%include 'proto2.inc'
Main:
mov si,welcome ;print message
call print
halt:
hlt
Code: Select all
welcome db 'Welcome to my OS!',0 ;welcome message
print:
lodsb ;load from si
cmp al,0 ;see if string has ended
je printend ;if yes?
mov ah,0Eh ;function params
mov bh, 0Fh
mov bl, 0
int 10h ;print!
jmp print
printend:
ret
Code: Select all
; I used Daniel's tutor at os resources as a template
[ORG 0]
start:
mov ax,0x7C00
mov ds,ax
mov ax,0x0000
mov ss,ax ; setting my stack
mov sp,0xFFFF
reset_drive:
mov ax, 0
mov dl, 0
int 13h
jc reset
read:
mov ax,1000h ; ES:BX = 1000:0000
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 read ; ERROR => Try again
mov ax,es
mov cs,ax ; i added this later, but it didn't solve my problem
jmp 1000h:0000 ; Jump to the program
times 510-($-$$) db 0
dw 0AA55h
and i use and image file to combine these files, image02.asm
Code: Select all
%include 'boot.asm'
%include 'kernelt2.asm'
nasm -f bin image02.asm -o image.bin
and
dd if=image.bin of=/dev/fd0
I'd really appreciate any help cause it's so simple and it's not working
Thank you