Commit 11ba22eb authored by Kevin Bracey's avatar Kevin Bracey
Browse files

Second attempt at ARTtmp fold

parent c06b89dd
; Copyright 1997 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.copyFilter
;;----------------------------------------------------------------
;; copy_filter_handler
;;
;; This is called by the Wimp when copying a rectangle
;;
;; Entry:
;;
;; R2-R5 - Destination bounding box.
;; R6-R9 - Source bounding box.
;; R10 - Window handle - 1
;;
;; Exit:
;;
;; All other registers preserved. (Except R12!)
;;
;; All interested filters called.
;;
;;
copy_filter_handler
Push "r0-r2,r10,r11,LR"
ADD r0,r10,#1
LDR r1,copy_filters
copy_filter_exit
CMP r1,#0
Pull "r0-r2,r10,r11,PC",EQ,^ ; End of list.
LDR r14,[r1,#next_ptr]
Push "r14"
LDR r12,[r1,#f_R12] ; Set R12.
[ {TRUE}
MOV LR,PC
LDR PC, [r1,#f_address]
NOP
|
STMFD sp!,{r0-r12}
LDR r3,[r1,#f_address]
MOV r1,sp
MOV r0,#0
MOV r2,pc
AND r2,r2,#3 ; should be 3
SWI &69cc0
LDMFD sp!,{r0-r12}
]
Pull "r1"
B copy_filter_exit
LNK s.PostFilter
; Copyright 1997 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.PoIcFilter
;;----------------------------------------------------------------
;; post_icon_filter_handler
;;
;; This is called by the Wimp on entry to int_get_rectangle, after
;; it has drawn the icons for the previous rectangle.
;;
;; Entry:
;;
;; R2 - Task handle of calling task.
;; R6-R9 - screen coordinates of rectangle (x0,y0,x1,y1)
;; R10 - window handle - 1
;;
;; Exit:
;;
;; All other registers preserved.
;;
;; All interested filters called.
;;
;;
post_icon_filter_handler
Push "r0-r2,LR"
MOV R2,R2,ASL #16
MOV R2,R2,LSR #16
ADD r0,r10,#1 ; find the window being redrawn
LDR r1,post_icon_filters
post_icon_filter_exit
CMP r1,#0
Pull "r0-r2,PC",EQ,^ ; End of list.
LDR r14,[r1,#next_ptr]
Push "r14"
LDR r14,[r1,#f_task]
TEQ r14,R2
CMPNE r14,#0
Pull "r1",NE
BNE post_icon_filter_exit ; Filter not interested.
LDR r12,[r1,#f_R12] ; Set R12.
[ {TRUE}
MOV LR,PC
LDR PC, [r1,#f_address]
NOP
|
STMFD sp!,{r0-r12}
LDR r3,[r1,#f_address]
MOV r1,sp
MOV r0,#0
MOV r2,pc
AND r2,r2,#3 ; should be 3
SWI &69cc0
LDMFD sp!,{r0-r12}
]
Pull "r1"
B post_icon_filter_exit
LNK s.CopyFilter
; Copyright 1997 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.PoRtFilter
;;----------------------------------------------------------------
;; post_rect_filter_handler
;;
;; This is called by the Wimp on exit from int_get_rectangle
;;
;; Entry:
;;
;; R2 - Task handle of calling task.
;; R6-R9 - screen coordinates of rectangle (x0,y0,x1,y1)
;; R10 - window handle - 1
;;
;; Exit:
;;
;; All other registers preserved.
;;
;; All interested filters called.
;;
;;
post_rect_filter_handler
Push "r0-r2,LR"
MOV R2,R2,ASL #16
MOV R2,R2,LSR #16
ADD r0,r10,#1 ; find the window being redrawn
LDR r1,post_rect_filters
post_rect_filter_exit
CMP r1,#0
Pull "r0-r2,PC",EQ,^ ; End of list.
LDR r14,[r1,#next_ptr]
Push "r14"
LDR r14,[r1,#f_task]
TEQ r14,R2
CMPNE r14,#0
Pull "r1",NE
BNE post_rect_filter_exit ; Filter not interested.
LDR r12,[r1,#f_R12] ; Set R12.
[ {TRUE}
MOV LR,PC
LDR PC, [r1,#f_address]
NOP
|
STMFD sp!,{r0-r12}
LDR r3,[r1,#f_address]
MOV r1,sp
MOV r0,#0
MOV r2,pc
AND r2,r2,#3 ; should be 3
SWI &69cc0
LDMFD sp!,{r0-r12}
]
Pull "r1"
B post_rect_filter_exit
; Can get away with this inline data as we'll only need to
; fake when softloading anyway.
; Eight words to store R2,R6-R9,R10,R12
fake_regdump
% 7*4
; The address that int_get_rectangle was supposed to return to
fake_retaddr
% 4
; We want to return to 2 instructions after this instruction
; in the Wimp's int_get_rectangle routine.
fake_magic_marker
TST R14,#&0C
int_get_rectangle_reentry_addr
DCD 0
; This rectangle filter checks that we are being called from
; the second rectangle filter call in the Wimp (R0=-1), and
; if so, we poke a new return address into the stack, so that
; int_get_rectangle returns to fakepostrect_handler.
; What we then do is return to within int_get_rectangle, having
; fixed the stack up, to where it sets the fg/bg colours
; (starting at the instruction "fake_magic_marker").
;
; The stack at this point contains 4 words from rect_filt_handler,
; 3 words from the Wimp's CallFilter macro, followed by
; handle, userblk and lr from int_get_rectangle.
sortout_fakepostrect
CMP r0,#-1
MOVNES pc,lr
Push "r0-r1,r10,lr"
ADR r0,fakepostrect_handler
LDR lr,[r13,#(4+4+3+2)*4] ; Fiddle with int_get_rectangle's
AND r1,lr,#&FC000003 ; lr
ORR r0,r0,r1
STR r0,[r13,#(4+4+3+2)*4]
LDR r10,[r13,#(4+4+3+0)*4] ; Get int_get_rectangle's handle
ADR r0,fake_regdump
STMIA r0,{r2,r6-r9,r10,r12,lr}
; Find int_get_rectangle_reentry_addr
LDR r0,int_get_rectangle_reentry_addr
TEQ r0,#0
Pull "r0-r1,r10,pc",NE
LDR lr,[r13,#(4+3)*4] ; Get original lr passed to rect filter
BIC lr,lr,#&FC000003
LDR r1,fake_magic_marker
; Scan forward to find the magic marker
05 LDR r0,[lr,#4]!
TEQ r0,r1
BNE %BT05
ADD lr,lr,#8
STR lr,int_get_rectangle_reentry_addr
Pull "r0-r1,r10,pc"
fakepostrect_handler
LDR lr,fake_retaddr
Push "r2,r6-r9,r10,r12,lr"
ADR lr,fake_regdump
LDMIA lr,{r2,r6-r9,r10,r12}
BL post_rect_filter_handler
Pull "r2,r6-r9,r10,r12"
LDR pc,int_get_rectangle_reentry_addr
LNK s.PoIcFilter
; Copyright 1997 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.rectFilter
;;----------------------------------------------------------------
;; rect_filter_handler
;;
;; This is called by the Wimp on entry to int_get_rectangle
;;
;; Entry:
;;
;; R2 - Task handle of calling task.
;;
;; Exit:
;;
;; All other registers preserved.
;;
;; All interested filters called.
;;
;;
rect_filter_handler
Push "r0-r2,LR" ; If you change this, change the
; sortout_fakepostrect routine
MOV R2,R2,ASL #16
MOV R2,R2,LSR #16
LDR LR, fake_postrect ; If we're faking post-rectangle
TEQ LR, #0 ; filters, and we have any
LDRNE LR, post_rect_filters ; claimants, go poke the
TEQNE LR, #0 ; Window Manager's stack
BLNE sortout_fakepostrect
LDR r0,[sp,#16+12+0] ; find the window being redrawn
ADD r0,r0,#1 ; turn pointer into window handle
; BTW - you didn't see that...
LDR r1,rect_filters
rect_filter_exit
CMP r1,#0
Pull "r0-r2,PC",EQ,^ ; End of list.
LDR r14,[r1,#next_ptr]
Push "r14"
LDR r14,[r1,#f_task]
TEQ r14,R2
CMPNE r14,#0
Pull "r1",NE
BNE rect_filter_exit ; Filter not interested.
LDR r12,[r1,#f_R12] ; Set R12.
[ {TRUE}
MOV LR,PC
LDR PC, [r1,#f_address]
NOP
|
STMFD sp!,{r0-r12}
LDR r3,[r1,#f_address]
MOV r1,sp
MOV r0,#0
MOV r2,pc
AND r2,r2,#3 ; should be 3
SWI &69cc0
LDMFD sp!,{r0-r12}
]
Pull "r1"
B rect_filter_exit
LNK s.PoRtFilter
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment