How is this ruining the stack!?

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
earlz
Member
Member
Posts: 1546
Joined: Thu Jul 07, 2005 11:00 pm
Contact:

How is this ruining the stack!?

Post by earlz »

I am making some floppy code but something is happening in it
can anyone tell me anything that might be happening to cause the stack to get empty?
this simple code

Code: Select all

void FDD_MotorOn(drive){
	if(drive==0){
		outportb(DOR,0x14);
	}else{
		outportb(DOR,0x25);
	}
	wait(500);
}
and if I comment out the wait then it all works good, and I have tested the wait function throughly so its not wait
if I call fdd_motoron in another function then I get "can not pop off of stack" and if I call it at a 1 function higher then I get just a triple fault(no stack error reported)
ComputerPsi
Member
Member
Posts: 83
Joined: Fri Oct 22, 2004 11:00 pm

Post by ComputerPsi »

Are you sure your stack segment isn't conflicting with your data or code segments?
Anything is possible if you put your mind to it.
ComputerPsi
earlz
Member
Member
Posts: 1546
Joined: Thu Jul 07, 2005 11:00 pm
Contact:

Post by earlz »

I'm pretty sure not but I'll make sure(my stack I think is at the end of my code/data)

ok I changed my stack, which I needed to do anyway but it didn't work

edit:
w00t! now it works! I accidentally typed EBP instead of ESP so yea changign the stack worked
thank you so much!

also I bet that a lot of the other problems I had was because of that too if it can only handle down 9 of these functions(plus about 30 vars)
digo_rp
Member
Member
Posts: 233
Joined: Sun Jun 05, 2005 11:00 pm

Post by digo_rp »

I think you have to take care of DMA transfer cuz floppy driver uses below 1MB mark, remember that...
Post Reply