Re: A92: PLEASE ! > HELP ! Interrupt & stack ! PLEH <


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

Re: A92: PLEASE ! > HELP ! Interrupt & stack ! PLEH <




Famille SCHERRER schrieb:
>
> 	////////////////////////////
> 	!!!! P L E A S E !!!!
> 	////////////////////////////
>
> I need some help about interrupt & the stack.
> Here is my problem.
>
> First I just saw a few minutes ago that when we was into an interrupt (like
>  the timer at 350Hz), the stack was the Supervisor Stack, isn't it ? 
Yes, it is, but you don't have to take care of that in writing source, the 
assembler does it for you. Exceptions are always run in supervisor mode on the 
68k.
(I saw
>  it with calling hexlib in the interrupt routine).
> So the stack pointer change when it call the interrupt, and is restored when
>  it come back to the program.
>
> HERE IS MY QUESTION : I want to change the return adress. (after each
>  interrupt, it goes to a specified address). So can I do 
> move.l 	#the_routine,(a7)	;put adr of new routine to go after the 
interrupt
> move.l	old_int,-(a7)		;put the old interrupt adress
> rts				;to go there
> It should change the return adress, isn't it ?
> (for that I think it work, because it work when I make it with 'bsr' and I
>  trace it with db92)
I don't know, but I would redefine the interrupt to execute a routine of my own 
which first executes the old routine and then does what I want
>
>
> Now, i want to do something harder :I want to change the stack pointer when
>  it will come back to the program.
>
> So I thought that If I changed a7 (with the right return adress, ok), it
>  would be OK. (it work when I use 'bsr' instead of the interrupt and when I
>  trace it with db92)
> BUT the stack pointer in the interrupt routine was in the supervisor stack,
>  and will change when It come back to the program (it will be in the user
>  stack)

With the change discribed above you are in supervisor-mode, so this problem 
doesn't occur
>
> >>> COULD SOMEONE TELL ME HOW I COULD DO TO HAVE A NEW STACK POINTER WHEN IT
>  COME BACK TO THE PROGRAM ??
>
> * What is saved when it called the interrupt ? (and in which order ?)
> I saw that there was the PC and the SR ? Is there something else ? And is
>  which order ?
First pc is pushed, then sr
>
> * Is the old stack register saved in order to restore it when It come back to
>  the program ? (so I could change that)
No, there are two stack-pointers in the 68k, the user stack-pointer a7 (sp) and 
a7' (ssp). You can't read a7' in user-mode, but you can access a7 in 
supervisor-mode using move.l usp,ax and move.l ax,usp
>
>
> >>>PLEASE<<<<
> If you have answers for that, mail me !
> I would be so grateful to you !
>
> THANKS A LOT
>
> Benoit SCHERRER
> p.c.scherrer@wanadoo.fr
hope that helps		A.K.
Arno.Kizina@t-online.de


References: