flat assembler
Message board for the users of flat assembler.

Index > OS Construction > Problem with boot loader

Author
Thread Post new topic Reply to topic
Vorobei99



Joined: 08 Mar 2008
Posts: 2
Vorobei99
I have collected a lot of information from this forum.But i have a problem with boot loader.This boot loader consists of few parts written by users of this forum.Here is the code
Code:
;---------------------------------------------------------------
;Sector 1
;---------------------------------------------------------------
use16
org 0x7C00
jmp 0x0000:main      
nop

main:
  xor ax,ax          ;ds=0
  mov ds,ax

  mov si,load_msg    ;wellcome msg
  call print_str

  xor ax,ax
  mov es,ax          ;buffer es:bx=0x0000:0x7E00
  mov bx,0x7E00

  mov dl,0           ; device   = 0
  mov dh,0           ; head       = 0
  mov ch,0           ; track         = 0
  mov cl,2           ; sector       = 2
  mov al,1           ; number of tracks to read = 1
  mov ah,2
  int 0x13

  jc read_error      ; if error run  procedure 'read_error'
  xor ax,ax
  mov ds,ax          ;ds=0
  jmp 0x0000:0x7E00  ; jump to loaded sector
;---------------------------------------------------------------
;Procedures
;---------------------------------------------------------------
print_str:
  mov ah,0x0E
  mov bh,0x00
  mov bl,0x07
 .nextchar:
  lodsb             
  or al,al
  jz .return
  int 0x10
  jmp .nextchar
 .return:
ret

read_error:
 mov si,error_msg   
 call print_str
 jmp $
ret
;---------------------------------------------------------------
;Data
;---------------------------------------------------------------

load_msg  db 'Loading Kernel...',13,10,0
error_msg db 'Error',13,10,0
;---------------------------------------------------------------
times 510-($-$$) db 0     
dw 0xAA55                 

;---------------------------------------------------------------
;Sector 2
;---------------------------------------------------------------
sector2:
  mov si,kernel_msg
  call print_str          ;print second message 
  hlt
;---------------------------------------------------------------
;DAta
;---------------------------------------------------------------

kernel_msg  db 'Loaded Kernel.',13,10,0
;---------------------------------------------------------------                                                 
    

It does not print second message?Whats the problem?Please help Embarassed


Description:
Filesize: 88.09 KB
Viewed: 622 Time(s)

problem.JPG


Post 08 Mar 2008, 09:09
View user's profile Send private message Reply with quote
edfed



Joined: 20 Feb 2006
Posts: 4238
Location: 2018
edfed
es=7E0h
bx=0

instead of es = 0
bx=7E00h
Post 08 Mar 2008, 10:37
View user's profile Send private message Visit poster's website Reply with quote
Vorobei99



Joined: 08 Mar 2008
Posts: 2
Vorobei99
Problem solved.In bochs everything run great.To solve problem in qemu i need to add
times 0x8000-$ db 0
Post 08 Mar 2008, 14:07
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-2020, Tomasz Grysztar. Also on YouTube, Twitter.

Website powered by rwasa.