Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

how to load fiels and kernal from boot loader

Status
Not open for further replies.

sagar474

Full Member level 5
Full Member level 5
Joined
Oct 18, 2009
Messages
285
Helped
5
Reputation
10
Reaction score
5
Trophy points
1,318
Location
India,kakinada
Activity points
3,123
I have written the following code, this is my first boot sector program code.
and it works fine, but now how can i load other files and kernel. if I use CD/DVD.


Code:
BITS 16

jmp start			;jump to actual executing code

;------------------------------message set to display on the screen--------------
wellcome_msg db 'wellcome to Sagar cool new operating system',13,10,0,
reboot_msg db   'Your system is going to reboot now....',0,
reboot_key	db 'Press any key to reboot',13,10,0,


;------------------------------Main Boot loading process starts hear---------------
	start:
	mov ax, 07C0h		; Set data segment to where we're loaded
	mov ds, ax		; 
	mov ax,9000h		;initialize the stack 
	mov ss,ax		;
	mov sp,100h		;
	
	mov si,wellcome_msg	;source index register (SI) points to the wellcome_message offset
	call print		;call the print subroutine. 
	
	

	mov si,reboot_key	; SI points to the off set of the string with label reboot_key
	call print		;call the print subroutine.
	
	call getkey
	
	mov si,reboot_msg	;SI points to offset of the string with label reboot_msg
	call print		;call the print subroutine.
	
	call reboot		;reboots the system.
	jmp $			; jump hear ie., infinite loop

;------------------------sub rotine---------------------------------------------
;----------------------to print string ------------------------------------------	
	print:			;print subroutine
	mov ah,0eh;		;loads ah with 0eh function for print char in BIOS int 10h
	repet:			;
	lodsb			;al<-----[si] and si=si+1 
	cmp al,0		;compare al and 0
	je done			;if al=0 then jump to lable don
	int 10h;		;call BIOS interrupt 10h video services
	jmp repet		;unconditional jump to label repit:
	done:
	ret			;return to main program.
;-------------------------------------------------------------------------------------		

;------------------------key board input------------------------------------------------
getkey:
mov ah,0			;function for keyboard char input stors ASCII value in al
int 16h				;BIOS keyboard interrupt 
ret
;-------------------------------------------------------------------------------------

;---------------------------reboot-----------------------------------------------------
     reboot:

                db 0EAh                 ; machine language to jump to FFFF:0000 (reboot)
                dw 0000h
                dw 0FFFFh
                ; no ret required; we're rebooting! (Hey, I just saved a byte :)
;--------------------------------------------------------------------------------------


	
times 510-($-$$) db 0	; Pad remainder of boot sector with 0s
	dw 0xAA55		; The standard PC boot signature

please help
thank you
 

For CD/DVD it is totally different. First try to develop for Floppy boot sector and HDD boot sector.
For your reference see FreeDOS boot sector code.

When you completed the FDD/HDD boot sector then refer to syslinux package and Eltorito boot loader.
 
Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top