4 ; Screen mode information caching (TMA)
6 ; © 1994-1998 Straylight
9 ;----- Licensing note -------------------------------------------------------
11 ; This file is part of Straylight's Quartz library.
13 ; Quartz 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 ; Quartz 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 Quartz. 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 ------------------------------------------------
36 ;----- Main code ------------------------------------------------------------
38 AREA |Quartz$$Code|,CODE,READONLY
40 ; --- screen_getInfo ---
44 ; On exit: R0 == pointer to screen information block
46 ; Use: This call returns a pointer to a block of information
47 ; about the current screen modes. The offset for different
48 ; bits of data are defined in screen.sh
53 LDR R0,screen__wSpace ;Get my workspace
54 ADD R0,R0,#4 ;Point to the data block
55 MOVS PC,R14 ;Return to caller
59 ; --- screen__cache ---
65 ; Use: Caches screen information for the current mode
69 STMFD R13!,{R0-R10,R14} ;Stack some registers
70 LDR R12,screen__wSpace ;Locate my workspace
72 ; --- Now read relevent mode variables ---
74 MOV R3,#1 ;A useful value
75 MOV R0,#-1 ;Get info on current mode
78 SWI OS_ReadModeVariable ;Read its value
79 MOV R4,R2 ;Look after xEig
80 MOV R9,R3,LSL R4 ;Get dx correctly
83 SWI OS_ReadModeVariable ;Read its value
84 MOV R5,R2 ;Look after yEig
85 MOV R10,R3,LSL R5 ;Get dy correctly
88 SWI OS_ReadModeVariable ;Read its value
89 MOV R6,R3,LSL R2 ;Calculate bpp
91 MOV R1,#11 ;XWindLimit
92 SWI OS_ReadModeVariable ;Read its value
93 ADD R2,R2,#1 ;Calculate screen width
94 MOV R7,R2,LSL R4 ;width=(XwindLimit+1)<<xEig
96 MOV R1,#12 ;XWindLimit
97 SWI OS_ReadModeVariable ;Read its value
98 ADD R2,R2,#1 ;Calculate screen width
99 MOV R8,R2,LSL R5 ;height=(YwindLimit+1)<<yEig
101 ; --- Now store the cached information ---
103 STMIB R12,{R4-R10} ;Store in my workspace
105 ; --- And return to caller ---
107 LDMFD R13!,{R0-R10,PC}^ ;Return
111 ; --- screen_init ---
113 ; On entry: R12 == pointer to private workspace
117 ; Use: Initialises the ptr system
122 STMFD R13!,{R0,R14} ;Stack some registers
124 ; --- Are we already initialised? ---
126 LDR R0,screen__flags ;Get my flags
127 TST R0,#sFlag__inited ;Are we initialised?
128 LDMNEFD R13!,{R0,PC}^ ;Yes -- return
130 ORR R0,R0,#sFlag__inited ;Set flags
131 STR R0,screen__flags ;And store them back
133 ; --- Now cache the current mode info ---
135 BL screen__cache ;Cache screen information
137 ; --- That's it now ---
139 LDMFD R13!,{R0,PC}^ ;Return
143 screen__wSpace DCD 0 ;My workspace pointer
145 ;----- Workspace ------------------------------------------------------------
150 screen__flags # 4 ;Flags
152 screen__xEig # 4 ;X Eig Factor
153 screen__yEig # 4 ;Y Eig Factor
154 screen__bpp # 4 ;Bits per pixel
155 screen__width # 4 ;Current screen width
156 screen__height # 4 ;Current screen height
157 screen__dx # 4 ;x pixel size
158 screen__dy # 4 ;y pixel size
160 screen__wSize EQU {VAR}-screen__wStart
162 sFlag__inited EQU (1<<0) ;I've been initialised
164 AREA |Quartz$$Service|,CODE,READONLY
166 DCD screen__cache,&46
168 AREA |Quartz$$Table|,CODE,READONLY
170 DCD screen__wSize ;Workspace size
171 DCD screen__wSpace ;Workspace pointer
172 DCD screen_init ;Initialisation code
175 ;----- That's all, folks ----------------------------------------------------