RE: A83: Running asm Programs...


[Prev][Next][Index][Thread]

RE: A83: Running asm Programs...




 
On Mon, 10 Apr 2000 16:09:04   Sebastiaan Roodenburg wrote:
>
>Did you copy the loader to a save place in memory, before calling it???


Yes, but thats whats going on:
In memory, the program to run is just after the 'shell':


	_________
	|	| 	$9327 = start of 'shell'
	|	| 
	|	| 
	|	| 
	|_______|	$xxxx = end of 'shell'
	|	| 	\
	|	| 	 \
	|	| 	  \
	|	| 	   \program I want to run
	|	| 	   /
	|	|	  /
	|	| 	 /
	|_______|	/ 


So when I swap the bytes ($9327 <> $prog_data) with the loader
that has been copied at $9157 (cmdshad), thats what occures:



	_________
 p [	|	| 	$9327 = start of program to run
 r [	|	| 
 o [	|	| 
 g [	|	| 
 r [	|-------| ] s	start of swapped 'shell' (that was the start of prog)
 a [	|XXXXXXX| ] h
 m [	|XXXXXXX| ] e
   [	|XXXXXXX| ] l	$ = end of loaded program
	|///////| ] l	$ = end of swapped 'shell'
	|///////|
	|	|
	|	|
	|_______|


The part with the 'X' is what has been overwrited by the program to run.
The program runs perfectly but the crashs occcures because when the
loader swaps back the bytes, it doesnt copy the 'shell' at $9327 but the
end of the program that has been loaded and the end of the swapped 'shell'.

Do I have to change my 'shell's position in memory before I swap it with the
program ??


Jean



Send FREE April Fool's Greetings to your friends!
http://www.whowhere.lycos.com/redirects/American_Greetings.rdct