4 ; Special DLL parts of wimp
6 ; © 1994-1998 Straylight
9 ;----- Licensing note -------------------------------------------------------
11 ; This file is part of Straylight's Steel library.
13 ; Steel is free software; you can redistribute it and/or modify
14 ; it under the terms of the GNU General Public License as published by
15 ; the Free Software Foundation; either version 2, or (at your option)
18 ; Steel is distributed in the hope that it will be useful,
19 ; but WITHOUT ANY WARRANTY; without even the implied warranty of
20 ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 ; GNU General Public License for more details.
23 ; You should have received a copy of the GNU General Public License
24 ; along with Steel. If not, write to the Free Software Foundation,
25 ; 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
27 ;----- Standard header ------------------------------------------------------
32 ;----- External dependencies ------------------------------------------------
34 IMPORT |_dll_wimpPoll|
35 IMPORT |_dll_wimpPollIdle|
37 ;----- Some flags and things -----------------------------------------------
39 dpoll__savefp EQU 1<<24 ;Bit to set to save FP state
41 ;----- Private data ---------------------------------------------------------
47 ;----- Polling code ---------------------------------------------------------
49 AREA |C$$Code|,CODE,READONLY
53 ; On entry: a1 == Wimp_Poll event mask
54 ; a2 == pointer to wimp_eventstr to be filled in
55 ; On exit: a1 == pointer to an os_error, or nothing
60 STMFD sp!,{lr} ;Look after some registers
62 ; --- Figure out about saving the FP status ---
64 LDR a4,=wimp__savefp ;Find the magic flag
65 LDR ip,[sl,#-536] ;Get the relocation
66 ADD a4,ip,a4 ;And relocate this address
67 LDR a4,[a4] ;Get the value of the flag
68 CMP a4,#0 ;Do we have to save FP state?
69 ORRNE a1,a1,#dpoll__savefp ;Yes -- set the flag
70 BICNE a1,a1,#dpoll__savefp ;No -- clear the flag
72 ; --- Call the SWI and get out again ---
74 ADD a2,a2,#4 ;Point to the big poll block
75 BL |_dll_wimpPoll| ;Get a Wimp event
76 SUB a2,a2,#4 ;Point to the wimp_eventstr
77 STRVC a1,[a2] ;Store the reason code away
78 MOVVC a1,#0 ;If no error, return NULL
79 LDMFD sp!,{pc}^ ;Return to caller nicely
83 ; --- wimp_pollidle ---
85 ; On entry: a1 == Wimp_Poll event mask
86 ; a2 == pointer to wimp_eventstr to be filled in
87 ; a3 == time before which thou shalt not return
88 ; On exit: a1 == pointer to an os_error, or nothing
93 STMFD sp!,{lr} ;Look after some registers
95 ; --- Figure out about saving the FP status ---
97 LDR a4,=wimp__savefp ;Find the magic flag
98 LDR ip,[sl,#-536] ;Get the relocation
99 ADD a4,ip,a4 ;And relocate this address
100 LDR a4,[a4] ;Get the value of the flag
101 CMP a4,#0 ;Do we have to save FP state?
102 ORRNE a1,a1,#dpoll__savefp ;Yes -- set the flag
103 BICNE a1,a1,#dpoll__savefp ;No -- clear the flag
105 ; --- Call the SWI and get out again ---
107 ADD a2,a2,#4 ;Point to the big poll block
108 BL |_dll_wimpPollIdle| ;Get a Wimp event
109 SUB a2,a2,#4 ;Point to the wimp_eventstr
110 STRVC a1,[a2] ;Store the reason code away
111 MOVVC a1,#0 ;If no error, return NULL
112 LDMFD sp!,{pc}^ ;Return to caller nicely
116 ; --- wimp_save_fp_state_on_poll ---
118 EXPORT wimp_save_fp_state_on_poll
119 wimp_save_fp_state_on_poll
122 LDR a1,=wimp__savefp ;Find the magic flag
123 LDR ip,[sl,#-536] ;Get the relocation
124 ADD a1,ip,a1 ;And relocate this address
125 MOV a2,#1 ;Store a TRUE value away
126 STR a2,[a1] ;Tuck it into my workspace
127 MOVS pc,lr ;Return to the caller
131 ; --- wimp_corrupt_fp_state_on_poll ---
133 EXPORT wimp_corrupt_fp_state_on_poll
134 wimp_corrupt_fp_state_on_poll
137 LDR a1,=wimp__savefp ;Find the magic flag
138 LDR ip,[sl,#-536] ;Get the relocation
139 ADD a1,ip,a1 ;And relocate this address
140 MOV a2,#0 ;Store a FALSE value away
141 STR a2,[a1] ;Tuck it into my workspace
142 MOVS pc,lr ;Return to the caller
146 ;----- Include the main wimp veneers ----------------------------------------