[A89] Re: interrupts


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

[A89] Re: interrupts




At 07:03 2002-04-04, you wrote:

>hi all
>does anyone know where i can find a tutorial on interrupts or some source
>code that is easy to understand about interrupts? ive looked at the source
>for gray4lib and gray7lib, but its sort of confusing. i seem to remember
>seeing a tutorial somewhere. a tutorial on grayscale might be helpful.
>thanks everyone!

What is it you want to do with interrupts?

I don't know of any tutorial but reading in the below could help you.
Basic usage info about the TIGCC interface to it is documented in the entry 
DEFINE_INT_HANDLER
but I suspect you want to use it in asm. Reading it could help in some 
understanding anyway. (Depending on how much you already know) The 
order-of-doing-things is basicly the same in both C and asm.

Info about what interrupt does what, and how to control their behaviour, 
you can find in J89hw.txt that you can find on my site 
http://alh.dhs.org/ti89/ (which is up again after two months downtime! 
horray! :)

If you look at the enum AutoInts in the TIGCC docs, you find what addresses 
the different interrupt vectors are stored at.
Those vectors are nothing more then memorypositions where you store the 
address of the interrupt function you want to run.
Then just write your interrupt function like any other subroutine, but end 
it with RTE instead of RTS, (or JMP to the old interrupt vector that you 
have stored somewhere, to run the standard interrupt. the old will RTE for 
you (same as ExecuteHandler() in tigcc))

If you want to write a link interrupt (autoint 4) that totally replaces the 
standard, special care must be taken to acknowledge the interrupt properly, 
or else the calc will lock up. Details in J89hw.txt.

I don't know if this helps you any, please tell :)
I could probably write (or find somewhere on my hd) an example source if I 
knew more about what it is you want to do.
I do have a file that uses a combo of C and asm for interrupts in hidekstat 
that can be found in http://d188.ryd.student.liu.se/ftp/calculator/ti89/source/
(It is a small hack to hide the 2ns, alpha, shift, diamond markers when 
using AMS ngetchx and dialog functions.)
But I doubt it is very easy to understand. It hooks itself both before and 
after the standard interrupt, instead of just before that is the standard 
way. This might look confusing if you don't know the details of how the 68k 
handles interrupts.

///Olle




References: