What's the point of resetting a floppy?

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
MarkZar
Posts: 13
Joined: Thu Feb 07, 2013 11:53 pm

What's the point of resetting a floppy?

Post by MarkZar »

I'm learning to read data from a floppy disk according to this tutorial( http://www.brokenthorn.com/Resources/OSDev5.html ), I just don't understand, what's the meaning by "reset"? What would happen if I don't reset it?

Thank you.

Code: Select all

.Reset:   ; <--why should I reset it?
	mov		ah, 0					; reset floppy disk function
	mov		dl, 0					; drive 0 is floppy drive
	int		0x13					; call BIOS
	jc		.Reset					; If Carry Flag (CF) is set, there was an error. Try resetting again
 
	mov		ax, 0x1000				; we are going to read sector to into address 0x1000:0
	mov		es, ax
	xor		bx, bx
 
.Read:
	mov		ah, 0x02				; function 2
	mov		al, 1					; read 1 sector
	mov		ch, 1					; we are reading the second sector past us, so its still on track 1
	mov		cl, 2					; sector to read (The second sector)
	mov		dh, 0					; head number
	mov		dl, 0					; drive number. Remember Drive 0 is floppy drive.
	int		0x13					; call BIOS - Read the sector
	jc		.Read					; Error, so try again
 
	jmp		0x1000:0x0				; jump to execute the sector!
User avatar
iansjack
Member
Member
Posts: 4707
Joined: Sat Mar 31, 2012 3:07 am
Location: Chichester, UK

Re: What's the point of resetting a floppy?

Post by iansjack »

It's the same as resetting any electronic device. It returns it to a known state.
Antti
Member
Member
Posts: 923
Joined: Thu Jul 05, 2012 5:12 am
Location: Finland

Re: What's the point of resetting a floppy?

Post by Antti »

That code is not something you should learn from. A reset should be done after few unsuccessful read tries. Then few read tries and another reset if still unsuccessful. This loop should be run few times and if still unsuccessful, an error message should be displayed. No endless read loops!
Post Reply