Page 1 of 1

My New Boot serctor need a bit of help

Posted: Sat Jul 19, 2008 9:30 pm
by PatrickV
Can you tell me what i am doing wrong here and how to correct it. what i was doing is print 1 string message and load the next sector. In my next sector will be the kernel which i will give what the users want in my Patricknet BETA 0.2 version which i want to turns some heads. I am not using LBA just standard CHS. I spent 2 days working on this fixing the print message error and creating the load sector part.

Code: Select all

;Book Disk Designed For Patricknet Systems
;Built By PatrickV(Project Manager)
;Free to use this bootsector with no limits and is Opensource

[bits 16]
[org 0x7c00]
jmp Start

; Data Strap
msg		db 'Patricknet Bootstrap - Version: 0.0.1 (BETA) (20/7/2008)',13,10,0
		 
Start:
	xor ax, ax
	mov ds, ax
	
	mov si, msg
	
	mov bx,512					;Buffer
	mov ah,02h        
	mov al,1                    ; Number of Sectors to read
	mov ch,0                    ; Track Number
	mov cl,2                    ; Sector Number
	mov dh,0                    ; Head Number
	mov dl,0                    ; Drive Number
	int 0x13
		
ch_loop:lodsb
	or al, al
	jz hang
	mov ah, 0x0E
	int 0x10
	jmp ch_loop

hang:
	jmp hang




padding     TIMEs 510-($-$$) db 0
;Flag Point Form Bios To Notice That This A Patricknet Boot Sector Is Vaild By Signature
Dw 0AA55h

Re: My New Boot serctor need a bit of help

Posted: Sun Jul 20, 2008 9:13 am
by thepowersgang
1. The text will never be printed as you have not called the print string bios function.

2. The value of bx should be the address of the data buffer not the size.
From Ralf Brown's Interrupt List for Int 13/AH=0x02 the buffer to be filled is at DS:BX

I suggest you have a look at the list http://www.ctyme.com/intr/int.htm for the video commands as well (Int 0x10)

Re: My New Boot serctor need a bit of help

Posted: Sun Jul 20, 2008 11:01 am
by suthers
He doesn't, but he doesn't do anything to stop it, so it goes straight through to it...
Jules

Re: My New Boot serctor need a bit of help

Posted: Sun Jul 20, 2008 11:46 am
by salil_bhagurkar
Guys, i guess he is calling the character printing bios function mov ah,0x0e int 10h. So this should work... but the problem is i guess the 'si' should be loaded before the ch_loop... int 13h might be changing it...

Re: My New Boot serctor need a bit of help

Posted: Sun Jul 20, 2008 11:53 am
by suthers
Yous should also change bh to 0 and bl to your character attribute (not supported by all bioses)
And also your not loading anything into AL, you need to load the next character using something like lodsb, which even increments SI for you...
Jules

Re: My New Boot serctor need a bit of help

Posted: Sun Jul 20, 2008 11:55 am
by suthers
looked at my bootloader, here's the code I use:

Code: Select all

PutStr:       
    mov ah,0x0E   
    mov bh,0x00   
    mov bl,0x07   
   .nextchar:  
    lodsb       
    or al,al         
    jz .return         
    int 0x10   
    jmp .nextchar   
   .return:       
    ret    
I think I've posted it before, so I'm sure a forum search would have helped you :wink:
Jules

Re: My New Boot serctor need a bit of help

Posted: Sun Jul 20, 2008 12:28 pm
by rutix
try this

Code: Select all

Start:
   xor ax, ax
   mov ds, ax
   
   
   mov bx,512               ;Buffer
   mov ah,02h       
   mov al,1                    ; Number of Sectors to read
   mov ch,0                    ; Track Number
   mov cl,1                    ; Sector Number
   mov dh,0                    ; Head Number
   mov dl,0                    ; Drive Number
   int 0x13
  
mov si, msg
mov ah, 0Eh

ch_loop:
  lodsb
  cmp al, 0 ; end of string
  je hang
  
  int 0x10
  jmp ch_loop

hang:
   jmp hang
i didnt try this, but i think it will work.

Re: My New Boot serctor need a bit of help

Posted: Mon Jul 21, 2008 4:23 pm
by PatrickV
I managed to print a message correctly but when it came to the loading of the sector i get stuck. I will take on some of your stuff and try it.

Re: My New Boot serctor need a bit of help

Posted: Mon Jul 21, 2008 6:15 pm
by 01000101
@rutix: isn't es:bx the segment and offset for the destination buffer address? In my code I fill es:bx with the destination for where the loaded sectors will go, not the size of the buffer.

ex:

Code: Select all

        mov ax, 0x1000
        mov es, ax
        mov bx, 0x0000          ; Destination address = 0x10000 (0x1000:0x0000)

        mov ah, 02h          
        mov al, 18              ; sector count
        mov ch, 0               
        mov cl, 01h             
        mov dh, 0x00           
        int 13h                 

Re: My New Boot serctor need a bit of help

Posted: Tue Jul 22, 2008 5:30 am
by rutix
yep that's right :) but i didnt change that part of the code...

Re: My New Boot serctor need a bit of help

Posted: Thu Jul 24, 2008 8:12 pm
by PatrickV
Thanks you guys for your help