Re: A83: Interrutps...


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

Re: A83: Interrutps...



At 08:44 PM 11/11/97 -0500, you wrote:
>I am interested too, mainly because I don't know anything about them. But
>here is what I do know.
>exx
>and ex don't deal with interupts they deal with the shadow registers. I
>think:-) exx swaps hl and 'hl bc and 'bc de and 'de and af and 'af ex swaps a
>and 'a ( I am not sure about that)

exx swaps bc,de, and hl with their shadow registers bc',de', and hl'

ex af,af' (the only "ex instruction" that deals with shadow registers)
swaps the af register pair and its shadow registers (af' as you may have
already guessed).

Interrupts themselves are a whole different story, I'll try to give a brief
outline, but if there is anything you do not understand, please feel free
to ask more questions.

On the ti-83 (as well as all other ti8x calculators) an interrupt occurs
every 1/200 of a second no matter what the calculator is doing (except of
course if it is off or interrupts have been disabled).  "Harnessing" this
interrupt and making it perform the task you specify is a fairly simple task.

The first step in creating your own interrupt routine is finding some free
memory (quite a bit of it is needed and it must have some very specific
properties) You need a 257 byte table at an address whose lower byte is 0
and enough space to store the routine you want executed 200 times/sec at an
address whose lower byte the same as its upper byte (such as $4242 or $1212
note: these are not addresses you should use, just examples of what your
address should look like, you will need to allocate some free memory or
find some safe ram with these characteristics)

Your 257 byte table should be filled with the byte that is duplicated to
create the address of your interrupt routine ($42 and $12 for the examples
above)

Once this is accomplished and your actual routine has been moved to the
correct address, you must load register I (note: this is in no way related
to the 'I's in the IX and IY registers, it is its own separate register)
with the upper byte of the address at which your 257 byte table lies
(remember the lower byte must be 0, but you needn't worry about loading
that into anything)

If you have successfully done this, all you need to do is set the interrupt
mode to 2 with the instruction 'IM 2' and you are all set.  Your interrupt
routine will now be run 200 times a second until you disable the interrupts
(DI) or set the interrupt mode back to 1 with 'IM 1' (im 1 is the normal
interrupt mode) the interrupt mode must always be 1 when the program
completes execution, or else problems arise.

As you might realize, the difficulty lies in finding suitable addresses at
which to store your table and the routine itself, I cannot offer much
assistance here as I have not had occasion to use interrupts on te ti-83
and so have not had any experience in finding or creating free memory with
these properties.

I hope this is all clear enough, but if not, feel free to ask any questions
and I will try to answer them as best I can.

	-Andrew


References: