help me I'm bigneer i have cometed a mistake

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
sagar474
Posts: 6
Joined: Mon May 09, 2011 11:15 pm

help me I'm bigneer i have cometed a mistake

Post by sagar474 »

I cant load sectors
my program is correct?

Code: Select all

BITS 16

jmp start			;jump to actual executing code

;------------------------------message set to display on the screen--------------
wellcome_msg db 'welcome to Sagar cool new operating system',13,10,0,
reboot_msg db   'Your system is going to reboot now....',13,10,0,
reboot_key	db 'Press any key to reboot',13,10,0,
resetmsg	db 'Press any key to reset flopy',13,10,0,
reset_success 	db 'reset successful',13,10,0,
read_sectors    db 'Press any key to read sector',13,10,0
read_success  	db 'Sector read successful....',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		;initlise the stack 
	mov ss,ax		;
	mov sp,100h		;
	
	mov si,wellcome_msg	;source index rigester (SI) ponits to the wellcome_message offset
	call print		;call the print subrotine. 
	
	mov si,resetmsg
	call print
	call getkey
	mov si,reset_success
	call print
	
	mov si,read_sectors
	call print
	call getkey
	call read_sector

	
	mov si,512;
	call print
		
	

	mov si,reboot_key	; SI points to the off set of the string with lable reboot_key
	call print		;call the prit subrotine.
	
	call getkey
	



	mov si,reboot_msg	;SI points to offset of the string with lable reboot_msg
	call print		;call the print subrotine.
	
	call reboot		;reboots the system.
	


	jmp $			; jump hear ie., infinite loop



;------------------------sub rotine---------------------------------------------
;----------------------to print string ------------------------------------------	
	print:			;print subrotine
	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		;compair al and 0
	je done			;if al=0 then jump to lable don
	int 10h;		;call BIOS intrupt 10h video services
	jmp repet		;unconditional jump to lable repit:
	done:
	ret			;return to main program.
;-------------------------------------------------------------------------------------		

;------------------------key board input------------------------------------------------
getkey:
mov ah,0			;functaion for keyboard char input stors ASCII value in al
int 16h				;BIOS keyboard intrupt 
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 :)
;--------------------------------------------------------------------------------------

;--------------------------reset flopy-------------------------------------------------
Reset_flopy:
.reset
mov dl,0;drive 0 is flopy drive
mov ah,0;reset flopy disk functation
int 13h; call BIOS
jc .reset
ret

;---------------------------------------------------------------------------------------
;---------------------------read sectors------------------------------------------------

read_sector:
mov ax,0x1000
mov es,ax
xor bx,bx

.read:
mov ah,0x02
mov al,1
mov ch,0
mov cl,2
mov dh,0
mov dl,1
int 0x13

jc  .read

jmp 0x1000:0x0
ret
;---------------------------------------------------------------------------------------
	
times 510-($-$$) db 0	; Pad remainder of boot sector with 0s
	dw 0xAA55		; The standard PC boot signature
jmp sec ;sector 2
newsector db 'Im the new sector',13,10,0,

sec: 
mov si,newsector
	mov ah,0eh;		;loads ah with 0eh function for print char in BIOS int 10h
	re:			;
	lodsb			;al<-----[si] and si=si+1 
	cmp al,0		;compair al and 0
	je did			;if al=0 then jump to lable don
	int 10h;		;call BIOS intrupt 10h video services
	jmp re		;unconditional jump to lable repit:
	did:
User avatar
DavidCooper
Member
Member
Posts: 1150
Joined: Wed Oct 27, 2010 4:53 pm
Location: Scotland

Re: help me I'm bigneer i have cometed a mistake

Post by DavidCooper »

Code: Select all

read_sector:
mov ax,0x1000
mov es,ax
xor bx,bx

.read:
mov ah,0x02
mov al,1
mov ch,0
mov cl,2
mov dh,0
mov dl,1
int 0x13

jc  .read
dl should be 0 if you're booting from a "flopy".

If that doesn't cure it, follow Berkus's advice and cut out all the message stuff to see if you can get the basics working first.
Help the people of Laos by liking - https://www.facebook.com/TheSBInitiative/?ref=py_c

MSB-OS: http://www.magicschoolbook.com/computing/os-project - direct machine code programming
Gigasoft
Member
Member
Posts: 856
Joined: Sat Nov 21, 2009 5:11 pm

Re: help me I'm bigneer i have cometed a mistake

Post by Gigasoft »

The clock is also running 43 days slow. Today is the 14th of May.
Post Reply