Re: A86: Hooking interrupt idea


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

Re: A86: Hooking interrupt idea



Steve86Asm@aol.com wrote:
> 
> So the TI8x's don't even have anything hooked up to the NMI lead on the vhip?
>  Strange...  I would think that that would be the most efficient way of
> staying off, wouldn't it be?  If not, then what actuallt does happen when the
> calc is off?

Nothing I think :) When the calc is shut down, it sends two bytes
through
port 3 (iirc) which probably enter low power mode and turns off the
display.
It also disable interrupts and then execute a HALT instruction. The HALT
instruction performs NOP (according to my Z80 book) until an interrupt
occurs,
and since interrupts have been disabled, that happens when the ON key is
pressed.
So, the calc executes a lot of NOPs :-)

> Also, what is this interrupt handler at 38H?  When does it get called?

Every time an interrupt occurs. In IM 1, which is default on the TI-8x
calcs,
a call to 38H is made.

> Oh, and what is RETN?

There are three different types of return instructions, RET, RETI and
RETN.
RET is used to end an ordinary subroutine, RETI to end a maskable
interrupt
handler (at the end of the default interrupt handler at 38H, there is
a RETI) and RETN to end a NMI (which doesn't exist on TI-8x calcs).

RET   pops PC from the stack

RETI  also pops PC from the stack, but "this instruction is recognize by
Zilog
      peripheral devices as the end of a peripheral service routine so
as to
      allow proper control of nested priority interrupts." (quote from
"Programming
      the Z80" by Rodney Zaks).

RETN  pops PC from the stacks AND copies IFF2 to IFF1. If this is true,
this instruction
      could be used (and probably RETI as well) instead of the plain
RET, but since
      it's one byte longer (and slower), it would be quite useless.

IFF1 and IFF2 are used so the Z80 knows if interrupt are possible. When
IFF1=0,
maskable interrupt routines is disabled (IFF1=0 after a DI or because of
a NMI).
NMI calls needs to backup IFF1 into IFF2 so DI/EI status is preserved.

But all this is not very necessary to know when programming asm on the
TI-86 :-)

-- 
Jimmy Mårdell                "The nice thing about standards is that 
mailto:mja@algonet.se         there are so many of them to choose from."
http://www.algonet.se/~mja    
IRC: Yarin                   "Sanity? I'm sure I have it on tape
somewhere!"


References: