; ; screen.s ; ; Screen mode information caching (TMA) ; ; © 1994-1998 Straylight ; ;----- Licensing note ------------------------------------------------------- ; ; This file is part of Straylight's Sapphire library. ; ; Sapphire 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. ; ; Sapphire 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 Sapphire. 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 ------------------------------------------------ GET sapphire:sapphire GET sapphire:event ;----- Main code ------------------------------------------------------------ AREA |Sapphire$$Code|,CODE,READONLY ; --- screen_getInfo --- ; ; On entry: -- ; ; On exit: R0 == pointer to screen information block ; ; Use: This call returns a pointer to a block of information ; about the current screen modes. The format of this block ; is defined above. EXPORT screen_getInfo screen_getInfo ROUT STMFD R13!,{R14} ;Save a register LDR R0,screen__wSpace ;Get my workspace offset LDR R14,sapph_workspace ;Load workspace base address ADD R0,R14,R0 ;Find workspace address ADD R0,R0,#4 ;Point to the data block LDMFD R13!,{PC}^ ;Return to caller LTORG ; --- screen_cache --- ; ; On entry: R12 points to workspace ; ; On exit: -- ; ; Use: Caches screen information for the current mode. EXPORT screen_cache screen_cache ROUT STMFD R13!,{R0-R10,R14} ;Stack some registers ; --- Now read relevent mode variables --- MOV R3,#1 ;A useful value MOV R0,#-1 ;Get info on current mode MOV R1,#4 ;XEigFactor SWI OS_ReadModeVariable ;Read its value MOV R4,R2 ;Look after xEig MOV R9,R3,LSL R4 ;Get dx correctly MOV R1,#5 ;YEigFactor SWI OS_ReadModeVariable ;Read its value MOV R5,R2 ;Look after yEig MOV R10,R3,LSL R5 ;Get dy correctly MOV R1,#9 ;Log2BPP SWI OS_ReadModeVariable ;Read its value MOV R6,R3,LSL R2 ;Calculate bpp MOV R1,#11 ;XWindLimit SWI OS_ReadModeVariable ;Read its value ADD R2,R2,#1 ;Calculate screen width MOV R7,R2,LSL R4 ;width=(XwindLimit+1)<