[comp.sys.amiga.programmer] DevPac

IMS103@psuvm.psu.edu (Ian Matthew Smith) (02/08/91)

I have noticed that some programs will work when run from
the debugger, but not from the CLI.  Most of the problems
are because DevPac clears all the registers that are not
needed, and if you assume that then the program may break
when run from the CLI.  But other problems I havn't been
able to track down.  Any others out there?

 - Ian Smith (ims103@psuvm.bitnet)

WTW101@psuvm.psu.edu (Bill Warner) (02/09/91)

In article <91038.202119IMS103@psuvm.psu.edu>, Ian Matthew Smith
<IMS103@psuvm.psu.edu> says:
>
>I have noticed that some programs will work when run from
>the debugger, but not from the CLI.  Most of the problems
>are because DevPac clears all the registers that are not
>needed, and if you assume that then the program may break
>when run from the CLI.  But other problems I havn't been
>able to track down.  Any others out there?
>
> - Ian Smith (ims103@psuvm.bitnet)


Well, I never got a reply to my last question about stack checking (if someone
could help me out here, please do!), but what I have figured out is that when
you start a program from the CLI it creates an empty stack area, but for some
reason it doesn't move your tasks stack pointer into this area.  Instead it
keeps the the stack pointer in the shell's stack frame (I use CONMAN, I wonder
if this makes a difference).  Now when you start from within DevPac it DOES
properly move the stack pointer into this newly created stack area.

What I have tried doing is something like this:

Startup:
   Save original stack pointer
   move.l tc_SPUpper(proper offset),sp

   xxxx


Exit:
   Restore original stack pointer
   rts


Now this doesn't work from within DevPac because it alrealy moves the stack
frame, but it SHOULD work when called from CLI.  But it doesn't :-(.  It just
crashes after a RTS.

So come on you Amiga GURUs!  How do I properly move the stack into the correct
stack frame on startup?  Where can I get the correct value for the address of
the stack limit from within a process started from the CLI?  Thanks in
advance!


-------------------------------------------------------------------------------


                                            Chris