A92: Thanks Aaron


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

A92: Thanks Aaron




Thanks for the help on the interrupt stuff.  The problem is that I tried 
that before.  Maybe it has to do with the fact that I'm replacing the 
keyboard interrupt (Auto_Int_2) at address [$68] in the interrupt vector 
table.  I guess it is also possible that my code had a bug in it, like a 
typo or something.  I also remember from creating user interrupts in C++ 
that if the code for the interrupt is too long it may try to call the 
interrupt again before the old one is finished, causing it to crash.  This 
may have also happened.  I guess I will mess around with it a little longer 
before I give up.  Also I may not really need it anymore since I solved the 
bug in reading the keypresses (from before).  It seems to run fairly 
smoothly, and requires little code in the program body, so it's not much of 
a hassle to handle the key reads manually.  I'll se what I can figure out.  
Thanks for your help.

Kebes




>From: "Aaron Hill" <serac@lightmail.com>
>Reply-To: assembly-92@lists.ticalc.org
>To: <assembly-92@lists.ticalc.org>
>Subject: A92: Re: Thanks David
>Date: Fri, 5 Nov 1999 20:54:35 -0800
>
>
> > I tried your idea of disabling the interrupts before reading the 
>keypresses.
> >   It works perfectly.  Thanks for the help.  Also, At one point I tried 
>to
> > create a custom interrupt for handling the keypresses (so it would all 
>be
> > done automatically)  but it failed.  I couldn't get the old interrupt 
>out
> > and the new one in.  It kept crashing and stuff.  Maybe you have 
>something
> > that could help me here.  If anyone has any ideas to help please send 
>them.
>
>The interrupt vector table is protected from writing.  You have to disable
>the protection first before you right to the table.  Then reenable it when
>you're done.  Unfortunately you will also need to mask out the particular
>interrupt you are modifiying.  This cannot be done as Fargo programs are 
>all
>run in user mode.  Ellsworth wrote a "function" to help you and it is tied
>in as a TRAP vector.  This piece of code will disable the protection, mess
>with the interrupts, and reenable the protection.
>
>
>; INITIALIZATION
>     move.w  #$0700,d0                ; Change SR (Status Register)
>     trap    #1                       ;
>     move.l  $64,old_int_1            ; Store old interrupt vector
>     bclr.b  #2,$600001               ; Disable write protection
>     move.l  #int_1,$64               ; Replace with our interrupt
>     bset.b  #2,$600001               ; Enable write protection
>     trap    #1                       ; Restore SR
>
>. . .
>
>; CLEAN UP
>     move.w  #$0700,d0                ; Change SR
>     trap    #1                       ;
>     bclr.b  #2,$600001               ; Disable write protection
>     move.l  #old_int1,$64            ; Restore the old interrupt
>     bset.b  #2,$600001               ; Enable write protection
>     trap    #1                       ; Restore SR
>
>. . .
>
>; INTERRUPT CODE
>int_1:
>     ; some code here
>     move.l  old_int_1,-(sp)          ; Also execute the old interrupt
>     rts
>
>. . .
>
>; DATA SECTION
>old_int_1    dc.l    0
>
>
>The %fargo%\doc\traps.txt file explains the interrupts.  It also explains 
>how
>to use the TRAP #1 function.  This should help you get some interrupt-based
>programs working.  Enjoy.
>
>
>====
>Aaron Hill (Redmond, Wash.)
>Electronic Mail: serac@lightmail.com
>IRC Nickname: serac (on EF-Net)
>ActiveWorlds Citizenship: serac
>
>

______________________________________________________
Get Your Private, Free Email at http://www.hotmail.com


Follow-Ups: