My New Boot serctor need a bit of help

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
PatrickV
Member
Member
Posts: 151
Joined: Sun Jul 06, 2008 7:50 pm
Location: New Zealand
Contact:

My New Boot serctor need a bit of help

Post 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
User avatar
thepowersgang
Member
Member
Posts: 734
Joined: Tue Dec 25, 2007 6:03 am
Libera.chat IRC: thePowersGang
Location: Perth, Western Australia
Contact:

Re: My New Boot serctor need a bit of help

Post 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)
Kernel Development, It's the brain surgery of programming.
Acess2 OS (c) | Tifflin OS (rust) | mrustc - Rust compiler
Currently Working on: mrustc
User avatar
suthers
Member
Member
Posts: 672
Joined: Tue Feb 20, 2007 3:00 pm
Location: London UK
Contact:

Re: My New Boot serctor need a bit of help

Post by suthers »

He doesn't, but he doesn't do anything to stop it, so it goes straight through to it...
Jules
User avatar
salil_bhagurkar
Member
Member
Posts: 261
Joined: Mon Feb 19, 2007 10:40 am
Location: India

Re: My New Boot serctor need a bit of help

Post 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...
User avatar
suthers
Member
Member
Posts: 672
Joined: Tue Feb 20, 2007 3:00 pm
Location: London UK
Contact:

Re: My New Boot serctor need a bit of help

Post 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
User avatar
suthers
Member
Member
Posts: 672
Joined: Tue Feb 20, 2007 3:00 pm
Location: London UK
Contact:

Re: My New Boot serctor need a bit of help

Post 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
rutix
Posts: 8
Joined: Fri Jul 04, 2008 8:24 pm

Re: My New Boot serctor need a bit of help

Post 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.
PatrickV
Member
Member
Posts: 151
Joined: Sun Jul 06, 2008 7:50 pm
Location: New Zealand
Contact:

Re: My New Boot serctor need a bit of help

Post 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.
User avatar
01000101
Member
Member
Posts: 1599
Joined: Fri Jun 22, 2007 12:47 pm
Contact:

Re: My New Boot serctor need a bit of help

Post 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                 
rutix
Posts: 8
Joined: Fri Jul 04, 2008 8:24 pm

Re: My New Boot serctor need a bit of help

Post by rutix »

yep that's right :) but i didnt change that part of the code...
PatrickV
Member
Member
Posts: 151
Joined: Sun Jul 06, 2008 7:50 pm
Location: New Zealand
Contact:

Re: My New Boot serctor need a bit of help

Post by PatrickV »

Thanks you guys for your help
Post Reply