; $NetBSD: grf_ultms.g,v 1.10 2009/11/09 15:35:27 is Exp $
;
; ite support for A2410.
;
; Copyright (c) 1995 Ignatios Souvatzis.
; All rights reserved.
;
; Redistribution and use in source and binary forms, with or without
; modification, are permitted provided that the following conditions
; are met:
; 1. Redistributions of source code must retain the above copyright
; notice, this list of conditions and the following disclaimer.
; 2. Redistributions in binary form must reproduce the above copyright
; notice, this list of conditions and the following disclaimer in the
; documentation and/or other materials provided with the distribution.
;
; THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
; IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
; OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
; IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
; INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
; NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
; DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
; THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
; (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
; THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
; This file contains the source code for grf_ultms.c. It is assembler
; code for the TMS34010 CPU/graphics processor, as understood by the
; in-tree version of Paul Mackerras' "gspa" assembler.
;
; Use 'make grf_ultms.c' to generate the .c file.
; memory map:
; FF800000 .. FF9FFFFF overlay planes
; FFA00000 .. FFA0FFFF ite support code
; FFA10000 .. FFA1FFFF ite support, input queue
; FFA20000 .. FFA2FEFF variables
; FFA2FF00 .. FFA2FFFF variables, X server
; FFA30000 .. FFA3FFFF font data
; FFA40000 .. FFA4FFFF font data, bold
; FFA50000 .. FFA5FFFF X server, input queue
; FFA60000 .. FFFFC000 X server, onboard pixmaps
; Start of data area
.org $FFA20000
d:
;
; Ring buffer for getting stuff from host
; Data buffer:
inbuf = $FFA10000 ; 64kbits here (8k bytes)
;
; Pointers: (these must be at address $FFA20000)
put: .long inbuf
get: .long inbuf
;
; Mode bits for communication between GSP and CPU
;
; GSP mode bits: set by CPU, control GSP operation
GSP_HOLD = 0
GSP_FLUSH = 1
GSP_ALT_SCRN = 2
GSP_DISP_CTRL = 3
GSP_NO_CURSOR = 4
GSP_CALL_X = 5
gsp_mode: .word 0
;
; Pointer to X operation routine
xproc: .long 0
; We leave the next few words for future communication requirements
.org d+0x100
;
; Other data:
magic: .blkl 1 ; set => screen already inited
MAGIC = 0xD0D0BEAC
.org d+0x200
font_adr:
;
; Font information is stored in the structure defined declared below.
;
bitmap_ptrs: .long $FFA30000 ; points to first bitmap
font_size: .long $00080008 ; Y:X bitmap size
under_row: .word 6 ; row # for underlines
under_ht: .word 1 ; thickness of underline
first_char: .word 32 ; first and last char in font
last_char: .word 255 ;
bold_smear: .word 1 ; for making bold fonts
bgcolor: .long 0 ; background color
fgcolor: .long $01010101 ; foreground color
;precomputed out of what the host gave us:
font_area: .word 64 ; in pixels
font_pitch: .word 8
font_lmo: .word 28
move a8,*a6+
move a8,a7
move a10,a11
smearlp:
and a12,a7
sll 1,a7
or a7,a8
dsj a11,smearlp
move a8,*a9+
dsj a5,mirlp
;; support odd-sized fonts. pitch must still be 8 or 16
move @font_size,a5,0
move @font_pitch,a6,0
sub a5,a6
move @font_adr,a5,1
add a5,a6
move a6,@font_adr,1
;;
jruc loop_end,l
testfor5:
dec a2
jrne testfor6
; loadclut --- load clut entry.
; 1==overlay index red green blue
; for speed reasons, the host will load the image clut directly rather
; than through us, but its not that expensive to support both here
; just in case
move a0,a4
addk $10,a4
move $fe800030,a6
move *a4+,a5,0
jrne t5l1
subk $20,a6
t5l1: move *a4+,a5,0
move a5,@$fe800000,0
move *a4+,a5,0
move a5,*a6,0
move *a4+,a5,0
move a5,*a6,0
move *a4+,a5,0
move a5,*a6,0
jruc loop_end,l
testfor6:
dec a2
jrne testfor7
; op 6: load new framebuffer size and position for ite support.
move a0,b10
addk $10,b10
move *b10+,b7,1
move b7,@screen_width,1
move *b10+,b4,1
move b4,@screen_origin,1
move *b10+,b3,0
move b3,@screen_pitch,0
lmo b3,b0
move b0,@convdp,0
move *b10,b0,0
move b0,@psize,0
move b0,@pixel_size,0 ; this syncs the psize write, too