[Search for users] [Overall Top Noters] [List of all Conferences] [Download this site]

Conference 7.286::atarist

Title:Atari ST, TT, & Falcon
Notice:Please read note 1.0 and its replies before posting!
Moderator:FUNYET::ANDERSON
Created:Mon Apr 04 1988
Last Modified:Tue May 06 1997
Last Successful Update:Fri Jun 06 1997
Number of topics:1433
Total number of notes:10312

680.0. "Keyboard Interrupts" by SUBURB::JAMESH (Nit Picking is my Business) Thu Nov 23 1989 08:08

    Hello friends,
    I'm trying to rpogram interrupts but get 2 bombs when I press a
    key. Here's what I'm doing:
    MOVE.L KBVECT,-(SP)		;Interrupt routine address
    MOVE.W #6,-(SP)             ;Keyboard
    MOVE.W #13,-(SP)            ;XBIOS MFPINT
    TRAP #14                    ;XBIOS call
    ADDQ.L #8,SP                ;Cleanup
    
    MOVE.W #6,-(SP)		;Enable keyboard interrupts
    MOVE.W #13,-(SP)		;XBIOS JENABINT
    TRAP #14			;XBIOS Call
    ADDQ.L #4,SP		;Cleanup
    
    
    KBVECT:   	Some routine
    		RTS                          
    
    I'm probably doing something very basically wrong but not being
    a programmer I don't see why I'm getting the bombs. Any help, in
    simple language please, would be greatly appreciated.
    Thanks.
    ...Howard
T.RTitleUserPersonal
Name
DateLines
680.1Address rather than contents ?1075::FORSTERThu Nov 23 1989 09:0313
    It may be a typo on your part, but shouldn't
    
    MOVE.L KBVECT,-(SP)
    
    be
    
    MOVE.L #KBVECT,-(SP)
    
    or
    
    PEA KBVECT
    
    
680.2exSUBURB::JAMESHNit Picking is my BusinessThu Nov 23 1989 11:035
    Thanks for your reply. I took the instruction from the Abacus ST
    Internals page 178 which actually shows: move.l vector,-(sp). I'll
    try again tonight with #KBVECT.
    Thanks again.
    ...Howard
680.3Not so easyHAM::LITSCHFri Nov 24 1989 09:2331
    Hello Howard!
    
    Creating an own interrupt service routine is especially difficult for
    the ST. Besides the problem mentioned in the previous reply, there are
    more of them:
    - The BIOS already uses interrupt-driven keyboard-input. If you change
    that vector, you essentially disable all standard keyboard input.
    - Not only keystrokes, but also mouse, joystick, and keyboard-clock
    send data through the very same line, so you have to handle them as
    well.
    - The 6850s for keyboard and MIDI share the same interrupt line, you
    have to handle them both.
    - It may happen that another input arrives while you are handling the
    current one. This will NOT create another interrupt because of the
    edge-triggered nature of them. You have to do a loop until there is no
    more data in any of the 6850s.
    
    Another bug in your code:
    Interrupt routines have to end using RTE, not RTS.
    
    Watch out for this:
    ALL registers (except SR, the 68k handles this for you) MUST be
    restored to their old values before leaving the routine, so use
    >   KBVECT:   	movem.l	d0-d7/a0-a6,-(a7)
    >			Some routine
    >			movem.l (a7)+,d0-d7/a0-a6
    >    		RTS
    Depending of your use of registers you may leave out the unaltered ones
    in the movem instructions.
    
    Jens