Archived

This topic is now archived and is closed to further replies.

bootsector help

This topic is 5002 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

im trying to make an os but i cant get the boot sector to work can someone tell me whats wrong with my code
[BITS 16]
[ORG 0]
	jmp start
	bootdrv		db 0
	sysstart	db ''Press any key to start system.'',13,10,0
	rebootmsg	db ''Press any key to reboot.'',13,10,0
	resetmsg	db ''Resetting drive...'',13,10,0
	readmsg		db ''Loading program...'',13,10,0
start:
	mov ax,0x7c0
	mov ds,ax
	mov [bootdrv],dl
	cli
	mov ax,0x9000
	mov ss,ax
	mov sp,0xffff
	sti
	mov si,sysstart
	call msg
	call keywait
	call reset
	call read
	push keywait
	push msg
	mov ax,1000h
	mov ds,ax
	call 1000h:0000
	mov ax,0x7c0
	mov ds,ax
	call reboot
reset:
	mov si,resetmsg
	call msg
	mov ax,0
	mov dl,[bootdrv]
	int 13h
	jc reset
	ret
reboot:
	mov si,rebootmsg
	call msg
	call keywait
	db 0EAh
	dw 0000h
	dw 0FFFFh
msg:
	lodsb
	or al,al
	jz msgdone
	mov ah,0eh
	mov bx,0007
	int 0x10
	jmp msg
msgdone:
	ret
keywait:
	mov ah,0
	int 016h
	ret
read:
	mov si,readmsg
	call msg
	mov ax,1000h
	mov es,ax
	mov bx,0
	mov ah,2
	mov al,5
	mov ch,0
	mov cl,2
	mov dh,0
	mov dl,[bootdrv]
	int 13h
	jc read
	ret
times 510-($-$$) db 0
	dw 0AA55h
 

Share this post


Link to post
Share on other sites
What's happening? How far is it coming?
Also, this is probably not the right forum for this kind of stuff, check out http://www.mega-tokyo.com/forum/index.php?board=1 instead.

[edited by - Lantz on April 4, 2004 6:18:26 PM]

Share this post


Link to post
Share on other sites