PostFilter 2.48 KB
Newer Older
Neil Turton's avatar
Neil Turton committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52
; Copyright 1996 Acorn Computers Ltd
;
; Licensed under the Apache License, Version 2.0 (the "License");
; you may not use this file except in compliance with the License.
; You may obtain a copy of the License at
;
;     http://www.apache.org/licenses/LICENSE-2.0
;
; Unless required by applicable law or agreed to in writing, software
; distributed under the License is distributed on an "AS IS" BASIS,
; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
; See the License for the specific language governing permissions and
; limitations under the License.
;
; > s.PostFilter

;;----------------------------------------------------------------
;; Post_filter_handler
;;
;; This is called by the Wimp on exit from Wimp_Poll
;;
;; Entry:
;;
;;      R0 - Event code
;;      R1 - Pointer to event block.
;;      R2 - Task handle of calling task.
;;
;; Exit:
;;      R0 - Modified event code
;;           or -1 to claim the event and not pass it to the application.
;;      [R1] may be modified to include data for the event.
;;
;;      All interested filters called.
;;
;;

post_filter_handler

        Push    "r1-r7,LR"

        MOV     R2,R2,ASL #16
        MOV     R2,R2,LSR #16

        MOV     R6,R0
        MOV     R7,R0

        LDR     r3,post_filters
01
        CMP     r3,#0
        CMPEQ   R6,#-1
        MOVEQ   R0,#-1
        CMP     r3,#0
53
      [ No26bitCode
Neil Turton's avatar
Neil Turton committed
54
        Pull    "r1-r7,PC",EQ          ; End of list.
55 56
      |
        Pull    "r1-r7,PC",EQ,^        ; End of list.
57
      ]
Neil Turton's avatar
Neil Turton committed
58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90
        LDR     r4,[r3,#next_ptr]
        Push    "r4"

        LDR     r14,[r3,#f_task]
        TEQ     r14,R2
        CMPNE   r14,#0
        Pull    "r3",NE
        BNE     %BT01                  ; Filter not interested in this task.

        LDR     r14,[r3,#f_mask]
        MOV     r4,#1
        CMP     r0,#31
        MOVLS   r4,r4,ASL r0
        MOVHI   r4,#0                  ; This event cannot be masked
        TST     r14,r4
        Pull    "r3",NE
        BNE     %BT01                  ; Filter not interested in this event.

        LDR     r12,[r3,#f_R12]        ; Set R12.
        LDR     r4, [r3,#f_address]
        Debug   xx,"MGR - Calling post filter."
        MOV     LR,PC                  ; Task handle is in R2.
        MOV     PC,r4                  ; Call filter (r0=event r1->block)
        NOP
post_filter_exit
        Pull    "r3"
        Debug   xx,"MGR - Post filter returned."

        CMP     R0,#-1
        MOVEQ   R6,R0
        MOVEQ   R0,R7
        B       %BT01

Robert Sprowson's avatar
Robert Sprowson committed
91
        LNK     Tail.s