Re: A89: Running asm programs (Xavier)


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

Re: A89: Running asm programs (Xavier)




Miles Raymond wrote:
> 
> How do I run an asm program from an asm program?  I don't want to
> detect any programs, I just want to run, say, Slippy.  So every time I
> run my program, and I get to the point, it will run Slippy.  Any help
> is greatly appreciated.

OK. Let's say that you want to run Slippy with Slippy into the main
folder (it will be more simple)

Then do the following

	pea	progname(pc)		;pushes the adress of the name of the program you
look for
	move.w	#9,-(a7)		;pushes the handle of the MAIN folder
	jsr	userlib::FindSymEntry	;looks for the program VAT adress
	addq.l	#6,a7			;restores the stack

	cmp.l	#0,a0			;if a0 = 0, the prog doesn't exist
	beq	\notfound
	move.w	12(a0),-(a7)		; pushes the handle of the program you want to run
	jsr	userlib::exec		; runs the program
	addq.l	#2,a7			; restores the stack

	rts			;exits

progname	dc.b	"slippy",0	;name of the prog to run


Here is it ! Do you need more precisions ?


Xavier VASSOR
---The Doors Team
E-mail:xvassor@mail.dotcom.fr
Doors Homepage: http://start.at/doors
ICQ:10241721



References: