Page 1 of 1
How to stop infinite loop?
Posted: Sat Dec 15, 2012 9:13 pm
by gabemaiberger
Hey I got a problem, my os is stuck at this one line of code
it is meant to jump beyond the boot sector but it just loops infinitely.
Re: How to stop infinite loop?
Posted: Sat Dec 15, 2012 9:23 pm
by linguofreak
Without seeing more code than that we can't say anything.
Re: How to stop infinite loop?
Posted: Sat Dec 15, 2012 9:27 pm
by Nessphoro
Receive an interrupt, change EIP.
Re: How to stop infinite loop?
Posted: Sun Dec 16, 2012 12:46 am
by bluemoon
gabemaiberger wrote:Hey I got a problem, my os is stuck at this one line of code
it is meant to jump beyond the boot sector but it just loops infinitely.
No, the jmp itself do not perform loop.
It's like asking how to avoid blowing up a house, ignite the kitchen cooker is meant to have cooking fire but it just explode.
The problem lies on other things. What is on 0x200? it look like executing random garbage.
Re: How to stop infinite loop?
Posted: Sun Dec 16, 2012 3:02 pm
by gabemaiberger
I actually changed my code up a bit so my next problem is how to find my bootloader on the disk. It is supposed to be in the first nine sectors of a floppy disk but it can't find "BOOTLOAD.BIN". Here is some code.
Code: Select all
mov cx, WORD [0x0080]
mov di, 0x0200
.LOOP:
push cx
mov cx, 0x000C ;length of filename
mov si, ImageName ;move image name into si
push di
rep cmpsb
pop di
je LOAD_FILE
pop cx
add di, 0x0020
loop .LOOP
jmp FAILURE
LOAD_FILE:
mov si, msgCRLF
call DisplayMessage
mov dx, WORD [di + 0x001A]
mov WORD [cluster], dx
mov ax, 0x0100
mov es, ax
mov bx, 0
xor cx, cx
mov cl, BYTE[SectorsPerCluster]
mov ax, WORD[cluster]
call ClusterLBA
call ReadSectors
jmp DONE
Re: How to stop infinite loop?
Posted: Sun Dec 16, 2012 4:09 pm
by Combuster
gabemaiberger wrote:It is supposed to be in the first nine sectors of a floppy disk
My crystal ball says it isn't. How are you trying to get it there?
Re: How to stop infinite loop?
Posted: Sun Dec 16, 2012 8:04 pm
by gabemaiberger
by combining all code into boot.bin and using
Re: How to stop infinite loop?
Posted: Mon Dec 17, 2012 2:52 am
by bluemoon
There is not enough information for anyone to guess what's wrong.
How do you pack all the things into boot.bin? Did you verify it, and how?
Re: How to stop infinite loop?
Posted: Mon Dec 17, 2012 3:32 am
by Combuster
floppy disk
(...)
/dev/sdf
Sounds like you're using an USB mass storage device rather than a true floppy drive.
Other than that, playing hide and seek with your code is not going to get you an answer really fast. People already start ignoring this thread because it has too many replies.