Re: A86: interrupts


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

Re: A86: interrupts




Cool, I understand now. Yes, that was a good explanation :) . I see that it
this is using Mode 1 Interrupt Response, I honestly didnt know that before.
So basically when 38h is called it returns to 38h instead of 60h and thus
bypasses all the ports. Are any of those ports important though? What do
they do?

>The interrupt itself is at 38h (I'm sure you knew that already :-) ;
>what the interrupt does is load a checksum into $d2fd and then make a
>call to $d2fe (the user interrupt routine).  After it returns, somewhere
>around 60h, it does alot of wacked out stuff with the ports.  Whenever
>you call, what you're actually doing is pushing the current program
>counter to the stack and loading the program counter with the address
>you pointed to (ex: call $d842).  An rst instruction will also push pc
>and in the same way; so will the interrupt.  Now, when the user
>interrupt executes, you have pc pushed onto the stack twice: the first
>address on the stack is the one where the user routine was called from
>the interrupt, the second one is the place of execution when the
>interrupt occured.  When you tell the cpu to pop hl, you are actually
>popping pc into hl--the address to return to from the user routine--and
>throwing it away.  When the reti executes, a different address will be
>loaded into the program counter: the original address from where 38h was
>called.  This way, you can still use the interrupt, but skip all the
>stuff that the ROM does with the ports and thus speed up applications
>using it.
>
>Not a terrible explanation, I hope?  :-)


Follow-Ups: