1 ; $NetBSD: grf_ultms.g,v 1.9 2005/12/11 12:16:28 christos Exp $
3 ; ite support for A2410.
6 ; Copyright (c) 1995 Ignatios Souvatzis.
9 ; Redistribution and use in source and binary forms, with or without
10 ; modification, are permitted provided that the following conditions
12 ; 1. Redistributions of source code must retain the above copyright
13 ; notice, this list of conditions and the following disclaimer.
14 ; 2. Redistributions in binary form must reproduce the above copyright
15 ; notice, this list of conditions and the following disclaimer in the
16 ; documentation and/or other materials provided with the distribution.
18 ; THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
19 ; IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
20 ; OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
21 ; IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
22 ; INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
23 ; NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24 ; DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25 ; THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26 ; (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
27 ; THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 ; This file contains the source code for grf_ultms.c. It is assembler
30 ; code for the TMS34010 CPU/graphics processor, as understood by the
31 ; in-tree version of Paul Mackerras' "gspa" assembler.
33 ; Use 'make grf_ultms.c' to generate the .c file.
36 ; FF800000 .. FF9FFFFF overlay planes
37 ; FFA00000 .. FFA0FFFF ite support code
38 ; FFA10000 .. FFA1FFFF ite support, input queue
39 ; FFA20000 .. FFA2FEFF variables
40 ; FFA2FF00 .. FFA2FFFF variables, X server
41 ; FFA30000 .. FFA3FFFF font data
42 ; FFA40000 .. FFA4FFFF font data, bold
43 ; FFA50000 .. FFA5FFFF X server, input queue
44 ; FFA60000 .. FFFFC000 X server, onboard pixmaps
51 ; Ring buffer for getting stuff from host
53 inbuf = $FFA10000 ; 64kbits here (8k bytes)
55 ; Pointers: (these must be at address $FFA20000)
60 ; Mode bits for communication between GSP and CPU
62 ; GSP mode bits: set by CPU, control GSP operation
72 ; Pointer to X operation routine
75 ; We leave the next few words for future communication requirements
80 magic: .blkl 1 ; set => screen already inited
83 screen_width: .word 1024
84 screen_height: .word 768
85 screen_origin: .long $FE000000 ; just a placeholder
86 screen_pitch: .word 8192 ; 1024*8
92 ; Font information is stored in the structure defined declared below.
94 bitmap_ptrs: .long $FFA30000 ; points to first bitmap
95 font_size: .long $00080008 ; Y:X bitmap size
96 under_row: .word 6 ; row # for underlines
97 under_ht: .word 1 ; thickness of underline
98 first_char: .word 32 ; first and last char in font
99 last_char: .word 255 ;
100 bold_smear: .word 1 ; for making bold fonts
102 bgcolor: .long 0 ; background color
103 fgcolor: .long $01010101 ; foreground color
104 ;precomputed out of what the host gave us:
105 font_area: .word 64 ; in pixels
110 ; Control register addresses
119 ; Bits in control register
120 T = $20 ; enable transparency
121 W = $C0 ; window options
122 PBH = $100 ; pixblt horiz dirn
123 PBV = $200 ; pixblt vertical dirn
124 PPOP = $7C00 ; pixel processing options
127 ; Bits in dpyctl register
128 SRT = $800 ; do serial register transfers
130 free_memory: .long free_memory_start
131 free_memory_start: ; allocate dynamic arrays from here
134 ; Program starts here.
141 setf 16,0,0 ; just in case
145 ; Set up sync, blank parameters
146 ; done by host through interface
148 ; set up overlay clut:
167 ; set up overlay planes:
173 ; set up global registers
174 move @screen_pitch,b3,0
175 move @screen_origin,b4,1
180 andn $7FE0,a0 ; clear PPOP, PBV, PBH, W, T fields
182 move @pixel_size,a0,0
187 ; clear the entire screen
190 move @screen_width,b7,1
229 move b10,@$fe800000,0
231 move b10,@$fe800020,0
234 move *b10+,b12,0 ; dummy move (faster than addk)
235 move *b10+,b12,0 ; char code
236 move @first_char,b11,0
237 sub b11,b12 ; minus first char in font
238 move @font_size,b7,1 ;dydx - char size->pixel array dimensions
244 mpyu b12,b11 ; times char offset
245 move @font_adr,b0,1 ; font bitmaps base
246 add b11,b0 ; character bitmap start addr. linear
250 move *b10+,b2,1 ; y:x
252 move *b10+,b11,0 ; flags
270 move @under_row,b11,0
271 sll 16,b11 ; shift into Y half
274 sll 16,b11 ; shift into Y half
275 movy b11,b7 ; and move Y half only
284 move *b10+,b9,0 ; dummy move
285 move *b10+,b9,0 ; color
286 move *b10+,b2,1 ; XY start address
287 move *b10+,b7,1 ; dydx
308 move @convdp,@convsp,0
309 move *b10+,b0,0 ; dummy move
310 move *b10+,b0,1 ; XY src
311 move *b10+,b7,1 ; dxdy
312 move *b10+,b2,1 ; XY dst
321 xok: move b11,@control,0
331 ; op 4 - mirror the font and precompute some values.
338 t4b8: move a6,@font_pitch,0
341 move @font_size+$10,a6,0
342 move @font_pitch,a5,0
347 move @first_char,a5,0
350 move @font_size+$10,a5,0
354 move $7f7f,a12 ; mask for bold smearing
355 jrgt t4bf ; wider than 8 pixels?
356 addk 1,a5 ; yes, the words are only half the # of rows
358 move $7fff,a12 ; mask for bold smearing changes, too
359 t4bf: move @font_adr,a6,1
361 addi $10000,a9 ; start address of bold font
364 ; fortunately, this loop fits into 3 of the 4 cache segments:
365 ; execution time: about 32 periods per word of font.
417 ;; support odd-sized fonts. pitch must still be 8 or 16
419 move @font_pitch,a6,0
431 ; loadclut --- load clut entry.
432 ; 1==overlay index red green blue
433 ; for speed reasons, the host will load the image clut directly rather
434 ; than through us, but its not that expensive to support both here
456 ; op 6: load new framebuffer size and position for ite support.
460 move b7,@screen_width,1
462 move b4,@screen_origin,1
464 move b3,@screen_pitch,0
469 move b0,@pixel_size,0 ; this syncs the psize write, too