;---====================== Start Software License ======================--- ;--== ==-- ;--== This license governs the use of this software, and your use of ==-- ;--== this software constitutes acceptance of this license. Agreement ==-- ;--== with all points is required to use this software. ==-- ;--== ==-- ;--== 1. You may use this software freely for personal use. ==-- ;--== ==-- ;--== 2. You may use this software freely to determine feasibility for ==-- ;--== commercial use. ==-- ;--== ==-- ;--== 3. You may use this software for commercial use if the author ==-- ;--== has given you written consent. ==-- ;--== ==-- ;--== 4. You may modify this software provided you do not remove the ==-- ;--== license and copyright notice. ==-- ;--== ==-- ;--== 5. You may distribute this software and derivative works to ==-- ;--== personal friends and work colleagues only. ==-- ;--== ==-- ;--== 6. You agree that this software comes “as-is” and with no ==-- ;--== warranty whatsoever, either expressed or implied, including, ==-- ;--== but not limited to, warranties of merchantability or fitness ==-- ;--== for a particular purpose. ==-- ;--== ==-- ;--== 7. You agree that the author will not be liable for any damages ==-- ;--== relating from the use of this software, including direct, ==-- ;--== indirect, consequential or incidental. This software is used ==-- ;--== entirely at your own risk and should it prove defective, you ==-- ;--== will assume full responsibility for all costs associated with ==-- ;--== servicing, repair or correction. ==-- ;--== ==-- ;--== Your rights under this license are terminated immediately if you ==-- ;--== breach it in any way. ==-- ;--== ==-- ;---======================= End Software License =======================--- ;---====================== Start Copyright Notice ======================--- ;--== ==-- ;--== Filename ..... asm_int.txt ==-- ;--== Download ..... http://www.spacewire.co.uk ==-- ;--== Author ....... Steve Haywood (steve.haywood@ukonline.co.uk) ==-- ;--== Copyright .... Copyright (c) 2004 Steve Haywood ==-- ;--== Project ...... Raptor-16 ==-- ;--== Version ...... 1.00 ==-- ;--== Conception ... 20 August 2004 ==-- ;--== Modified ..... N/A ==-- ;--== ==-- ;---======================= End Copyright Notice =======================--- ;---========================= Start Description ========================--- ;--== ==-- ;--== This source demonstates a simple interrupt system where a ==-- ;--== counter (the user code) loops around and around but can be ==-- ;--== interrupted and modified by the following three interrupts:- ==-- ;--== ==-- ;--== Interrupt 1 - Decrement counter value 100 times. ==-- ;--== Interrupt 3 - Half Counter value. ==-- ;--== Interrupt 7 - Reset counter to zero. ==-- ;--== ==-- ;--== The counter value apears on Port 0 (Dout) for monitoring. ==-- ;--== ==-- ;--== Source assembles into 25 words (50 bytes). ==-- ;--== ==-- ;---========================== End Description =========================--- ;-------------------------------------------------------------- ; Initial Code Jump (1-word only) Start BraQ Code ; Branch to User Code ;-------------------------------------------------------------- ; Interrupt Vector Table (7 x 1-Word Instructions Only) IntVecA BraQ InterruptA ; Branch to Interrupt 1 IntVecB Rti ; Unused Interrupt IntVecC BraQ InterruptC ; Branch to Interrupt 3 IntVecD Rti ; Unused Interrupt IntVecE Rti ; Unused Interrupt IntVecF Rti ; Unused Interrupt IntVecG BraQ InterruptG ; Branch to Interrupt 7 ;-------------------------------------------------------------- ; Interrupt 1 - Decrement Port 0 Counter 100 times. InterruptA Move D0,-(SP) ; Save D0 LoadQ #100,D0 ; Loop Count = 100 LoopA SubQ #1,P0 ; Decrease Port 0 Counter SubQ #1,D0 ; Decrement Loop Count BraQ zrc,LoopA ; Loop if Loop Count > 0 Move (SP)+,D0 ; Restore D0 Rti ; Return from Interrupt ;-------------------------------------------------------------- ; Interrupt 3 - Half Port 0 Counter. InterruptC ShrQ #1,P0 ; Half Port 0 Counter Rti ; Return from Interrupt ;-------------------------------------------------------------- ; Interrupt 7 - Reset Port 0 Counter. InterruptG MoveQ #0,P0 ; Reset Port 0 Counter Rti ; Return from Interrupt ;-------------------------------------------------------------- ; User Code - Increment Port 0 Counter. Code Move #2048,SP ; Set-up Stack Pointer Move #%1000101,CR ; Enable Ints 1, 3 and 7 Loop AddQ #1,P0 ; Increase Port 0 Counter BraQ Loop ; Loop Back ;--------------------------------------------------------------