[A83] Re: Interupts on TI-83 Plus


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

[A83] Re: Interupts on TI-83 Plus




> From: <ComAsYuAre@aol.com>
>
> It's easy enough to make the ROM think that the last key pressed was
enter...
>
>  ld a,skEnter
>  ld (kbdScanCode),a    ;I believe this is the symbol name...
>
> That way you can use the keyboard port all you want and still ensure that
the
> home screen doesn't misinterpret already held-down keys.

Just disabling interrupts before the loop will do as long as you don't
enable interrupts again or use a rom call that enables them (in the loop).
By disabling interrupts you prevent the interrupt handler from scanning keys
and affecting key buffers. Anyway, if you don't need the extra speed of
direct input, I'd advise to use _getcsc.

> If you disable interrupts before exiting, you're just asking for trouble.

Not any that I know of. Interrupts get reenabled when the TI-OS calls
_getkey or even earlier perhaps.

> > Use the romcall _getcsc to scan for enter, instead of direct input. Just
> > bcall it and compare A with 9 to see if enter was pressed.
> > (the halt is there to safe some battery power)
> >
> > loop:
> >     ...
> >     halt
> >     bcall(_getcsc)
> >     cp    9
> >     ret   z
> >     jr    loop
> >
> > Or, if you really want to use direct input then disable interrupts with
DI.
> >
> > The problem is that when you use direct input not only you detect the
key
> > press but also the TI-OS. So, your program returns properly to the
TI-OS,
> > but the latter thinks enter has been pressed and not yet been handled,
> > resulting in executing the last command, which is your program, like
when
> > your program would have returned good and you pressed enter again. If
you
> > used 2nd instead of enter, you would see that 2nd was set when your
program
> > returns.
> >
> > So, to handle a key press use _getcsc. Or, do use direct input and make
sure
> > the TI-OS can't scan for key presses by disabling interrupts.
> >
> > Tijl Coosemans
> >
> > ----- Original Message -----
> > From: "Dale Watson" <merlin@cinternet.net>
> > To: <assembly-83@lists.ticalc.org>
> > Sent: Friday, July 27, 2001 4:35 PM
> > Subject: [A83] Interupts on TI-83 Plus
> >
> >
> > >
> > > I am trying to write a program that will stop when you press the enter
> > key.
> > > The problem was that this would restart the program as soon as it gave
> > > control to TI-OS.  I tried to solve this problem by telling it to
search
> > for
> > > the enter key being pressed and then released before giving control to
> > > TI-OS.  This didn't seem to do anything.  I think it might be the
> > interupts.
> > > Does anyone know what all the interupts are on the TI-83 Plus?
> > >
> > > Scot
> > >
> > >




References: