; ; wimp_dll.s ; ; Special DLL parts of wimp ; ; © 1994-1998 Straylight ; ;----- Licensing note ------------------------------------------------------- ; ; This file is part of Straylight's Steel library. ; ; Steel is free software; you can redistribute it and/or modify ; it under the terms of the GNU General Public License as published by ; the Free Software Foundation; either version 2, or (at your option) ; any later version. ; ; Steel is distributed in the hope that it will be useful, ; but WITHOUT ANY WARRANTY; without even the implied warranty of ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ; GNU General Public License for more details. ; ; You should have received a copy of the GNU General Public License ; along with Steel. If not, write to the Free Software Foundation, ; 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ;----- Standard header ------------------------------------------------------ GET libs:header GET libs:SWIs ;----- External dependencies ------------------------------------------------ IMPORT |_dll_wimpPoll| IMPORT |_dll_wimpPollIdle| ;----- Some flags and things ----------------------------------------------- dpoll__savefp EQU 1<<24 ;Bit to set to save FP state ;----- Private data --------------------------------------------------------- AREA |C$$data|,DATA wimp__savefp DCD 1 ;----- Polling code --------------------------------------------------------- AREA |C$$Code|,CODE,READONLY ; --- wimp_poll --- ; ; On entry: a1 == Wimp_Poll event mask ; a2 == pointer to wimp_eventstr to be filled in ; On exit: a1 == pointer to an os_error, or nothing EXPORT wimp_poll wimp_poll ROUT STMFD sp!,{lr} ;Look after some registers ; --- Figure out about saving the FP status --- LDR a4,=wimp__savefp ;Find the magic flag LDR ip,[sl,#-536] ;Get the relocation ADD a4,ip,a4 ;And relocate this address LDR a4,[a4] ;Get the value of the flag CMP a4,#0 ;Do we have to save FP state? ORRNE a1,a1,#dpoll__savefp ;Yes -- set the flag BICNE a1,a1,#dpoll__savefp ;No -- clear the flag ; --- Call the SWI and get out again --- ADD a2,a2,#4 ;Point to the big poll block BL |_dll_wimpPoll| ;Get a Wimp event SUB a2,a2,#4 ;Point to the wimp_eventstr STRVC a1,[a2] ;Store the reason code away MOVVC a1,#0 ;If no error, return NULL LDMFD sp!,{pc}^ ;Return to caller nicely LTORG ; --- wimp_pollidle --- ; ; On entry: a1 == Wimp_Poll event mask ; a2 == pointer to wimp_eventstr to be filled in ; a3 == time before which thou shalt not return ; On exit: a1 == pointer to an os_error, or nothing EXPORT wimp_pollidle wimp_pollidle ROUT STMFD sp!,{lr} ;Look after some registers ; --- Figure out about saving the FP status --- LDR a4,=wimp__savefp ;Find the magic flag LDR ip,[sl,#-536] ;Get the relocation ADD a4,ip,a4 ;And relocate this address LDR a4,[a4] ;Get the value of the flag CMP a4,#0 ;Do we have to save FP state? ORRNE a1,a1,#dpoll__savefp ;Yes -- set the flag BICNE a1,a1,#dpoll__savefp ;No -- clear the flag ; --- Call the SWI and get out again --- ADD a2,a2,#4 ;Point to the big poll block BL |_dll_wimpPollIdle| ;Get a Wimp event SUB a2,a2,#4 ;Point to the wimp_eventstr STRVC a1,[a2] ;Store the reason code away MOVVC a1,#0 ;If no error, return NULL LDMFD sp!,{pc}^ ;Return to caller nicely LTORG ; --- wimp_save_fp_state_on_poll --- EXPORT wimp_save_fp_state_on_poll wimp_save_fp_state_on_poll ROUT LDR a1,=wimp__savefp ;Find the magic flag LDR ip,[sl,#-536] ;Get the relocation ADD a1,ip,a1 ;And relocate this address MOV a2,#1 ;Store a TRUE value away STR a2,[a1] ;Tuck it into my workspace MOVS pc,lr ;Return to the caller LTORG ; --- wimp_corrupt_fp_state_on_poll --- EXPORT wimp_corrupt_fp_state_on_poll wimp_corrupt_fp_state_on_poll ROUT LDR a1,=wimp__savefp ;Find the magic flag LDR ip,[sl,#-536] ;Get the relocation ADD a1,ip,a1 ;And relocate this address MOV a2,#0 ;Store a FALSE value away STR a2,[a1] ;Tuck it into my workspace MOVS pc,lr ;Return to the caller LTORG ;----- Include the main wimp veneers ---------------------------------------- LNK s.wimp_main