]> git.sur5r.net Git - cc65/blob - asminc/tgi-kernel.inc
Added library reference address to lightpen driver header.
[cc65] / asminc / tgi-kernel.inc
1 ;*****************************************************************************/
2 ;*                                                                           */
3 ;*                                tgi-kernel.inc                             */
4 ;*                                                                           */
5 ;*                             TGI kernel interface                          */
6 ;*                                                                           */
7 ;*                                                                           */
8 ;*                                                                           */
9 ;* (C) 2002-2012, Ullrich von Bassewitz                                      */
10 ;*                Roemerstrasse 52                                           */
11 ;*                D-70794 Filderstadt                                        */
12 ;* EMail:         uz@cc65.org                                                */
13 ;*                                                                           */
14 ;*                                                                           */
15 ;* This software is provided 'as-is', without any expressed or implied       */
16 ;* warranty.  In no event will the authors be held liable for any damages    */
17 ;* arising from the use of this software.                                    */
18 ;*                                                                           */
19 ;* Permission is granted to anyone to use this software for any purpose,     */
20 ;* including commercial applications, and to alter it and redistribute it    */
21 ;* freely, subject to the following restrictions:                            */
22 ;*                                                                           */
23 ;* 1. The origin of this software must not be misrepresented; you must not   */
24 ;*    claim that you wrote the original software. If you use this software   */
25 ;*    in a product, an acknowledgment in the product documentation would be  */
26 ;*    appreciated but is not required.                                       */
27 ;* 2. Altered source versions must be plainly marked as such, and must not   */
28 ;*    be misrepresented as being the original software.                      */
29 ;* 3. This notice may not be removed or altered from any source              */
30 ;*    distribution.                                                          */
31 ;*                                                                           */
32 ;*****************************************************************************/
33
34
35
36 ;------------------------------------------------------------------------------
37 ; The driver header
38
39 .struct TGI_HDR
40         ID                  .byte   3   ; Contains 0x74, 0x67, 0x69 ("tgi")
41         VERSION             .byte   1   ; Interface version
42         LIBREF              .addr       ; Library reference
43         VARS                .struct
44             XRES            .word   1   ; X resolution
45             YRES            .word   1   ; Y resolution
46             COLORCOUNT      .byte   1   ; Number of available colors
47             PAGECOUNT       .byte   1   ; Number of screens available
48             FONTWIDTH       .byte   1   ; System font width in pixel
49             FONTHEIGHT      .byte   1   ; System font height in pixel
50             ASPECTRATIO     .word   1   ; Fixed point 8.8 format
51             FLAGS           .byte   1   ; TGI driver flags
52         .endstruct
53         JUMPTAB             .struct
54             INSTALL         .addr       ; INSTALL routine
55             UNINSTALL       .addr       ; UNINSTALL routine
56             INIT            .addr       ; INIT routine
57             DONE            .addr       ; DONE routine
58             GETERROR        .addr       ; GETERROR routine
59             CONTROL         .addr       ; CONTROL routine
60             CLEAR           .addr       ; CLEAR routine
61             SETVIEWPAGE     .addr       ; SETVIEWPAGE routine
62             SETDRAWPAGE     .addr       ; SETDRAWPAGE routine
63             SETCOLOR        .addr       ; SETCOLOR routine
64             SETPALETTE      .addr       ; SETPALETTE routine
65             GETPALETTE      .addr       ; GETPALETTE routine
66             GETDEFPALETTE   .addr       ; GETDEFPALETTE routine
67             SETPIXEL        .addr       ; SETPIXEL routine
68             GETPIXEL        .addr       ; GETPIXEL routine
69             LINE            .addr       ; LINE routine
70             BAR             .addr       ; BAR routine
71             TEXTSTYLE       .addr       ; TEXTSTYLE routine
72             OUTTEXT         .addr       ; OUTTEXT routine
73             IRQ             .addr       ; IRQ routine
74         .endstruct
75 .endstruct
76
77 ;------------------------------------------------------------------------------
78 ; The TGI API version, stored at TGI_HDR_VERSION
79
80 TGI_API_VERSION         = $04
81
82 ;------------------------------------------------------------------------------
83 ; Bitmapped tgi driver flags, stored in TGI_HDR::VARS::FLAGS.
84 ; Beware: Some of the bits are tested using the BIT instruction, so do not
85 ; change the values without checking the code!
86
87 TGI_BM_FONT_FINESCALE   = $80           ; Bitmap fonts are fine grained scalable
88
89 ;------------------------------------------------------------------------------
90 ; Text constants
91
92 TGI_FONT_BITMAP         = 0
93 TGI_FONT_VECTOR         = 1
94
95 TGI_TEXT_HORIZONTAL     = 0
96 TGI_TEXT_VERTICAL       = 1
97
98 ;----------------------------------------------------------------------------
99 ; Results of tgi_outcode
100
101 TGI_CLIP_NONE           = $00
102 TGI_CLIP_LEFT           = $01
103 TGI_CLIP_RIGHT          = $02
104 TGI_CLIP_BOTTOM         = $04
105 TGI_CLIP_TOP            = $08
106
107 ;------------------------------------------------------------------------------
108 ; ASM accessible color constants
109
110         .global tgi_color_black:zp      ; Target-specific value for black
111         .global tgi_color_white:zp      ; Target-specific value for white
112
113 ;------------------------------------------------------------------------------
114 ; C accessible variables
115
116         .global _tgi_drv                ; Pointer to driver
117         .global _tgi_error              ; Last error code
118         .global _tgi_gmode              ; Flag: graphics mode active
119         .global _tgi_curx               ; Current drawing cursor X
120         .global _tgi_cury               ; Current drawing cursor Y
121         .global _tgi_color              ; Current drawing color
122         .global _tgi_font               ; Which font to use
123         .global _tgi_textdir            ; Current text direction
124         .global _tgi_vectorfont         ; Pointer to vector font
125         .global _tgi_textscalew         ; Text magnification for the width
126         .global _tgi_textscaleh         ; Text magnification for the height
127         .global _tgi_charwidth          ; Width of scaled system font char
128         .global _tgi_charheight         ; Height of scaled system font char
129         .global _tgi_xres               ; X resolution of the current mode
130         .global _tgi_yres               ; Y resolution of the current mode
131         .global _tgi_xmax               ; Maximum X coordinate
132         .global _tgi_ymax               ; Maximum Y coordinate
133         .global _tgi_colorcount         ; Number of available colors
134         .global _tgi_pagecount          ; Number of available screen pages
135         .global _tgi_fontwidth          ; System font width
136         .global _tgi_fontheight         ; System font height
137         .global _tgi_aspectratio        ; Aspect ratio, fixed point 8.8
138         .global _tgi_flags              ; TGI driver flags
139
140 ;------------------------------------------------------------------------------
141 ; ASM accessible variables
142
143         .global tgi_clip_x1             ; Coordinate for line clipper
144         .global tgi_clip_y1             ; Coordinate for line clipper
145         .global tgi_clip_x2             ; Coordinate for line clipper
146         .global tgi_clip_y2             ; Coordinate for line clipper
147
148 ;------------------------------------------------------------------------------
149 ; Driver entry points
150
151         .global tgi_install
152         .global tgi_uninstall
153         .global tgi_init
154         .global tgi_done
155         .global tgi_geterror
156         .global tgi_control
157         .global tgi_clear
158         .global tgi_setviewpage
159         .global tgi_setdrawpage
160         .global tgi_setcolor
161         .global tgi_setpalette
162         .global tgi_getpalette
163         .global tgi_getdefpalette
164         .global tgi_setpixel
165         .global tgi_getpixel
166         .global tgi_line
167         .global tgi_bar
168         .global tgi_textstyle
169         .global tgi_outtext
170
171 ;------------------------------------------------------------------------------
172 ; ASM functions
173
174         .global tgi_clear_ptr
175         .global tgi_clippedline
176         .global tgi_curtoxy
177         .global tgi_getset
178         .global tgi_imulround
179         .global tgi_inv_arg
180         .global tgi_inv_drv
181         .global tgi_linepop
182         .global tgi_outcode
183         .global tgi_popxy
184         .global tgi_popxy2
185         .global tgi_set_ptr
186
187 ;------------------------------------------------------------------------------
188 ; C callable functions
189
190         .global _tgi_arc
191         .global _tgi_bar
192         .global _tgi_circle
193         .global _tgi_clear
194         .global _tgi_done
195         .global _tgi_ellipse
196         .global _tgi_getaspectratio
197         .global _tgi_getcolor
198         .global _tgi_getcolorcount
199         .global _tgi_getdefpalette
200         .global _tgi_geterror
201         .global _tgi_geterrormsg
202         .global _tgi_getmaxcolor
203         .global _tgi_getmaxx
204         .global _tgi_getmaxy
205         .global _tgi_getpagecount
206         .global _tgi_getpalette
207         .global _tgi_getpixel
208         .global _tgi_gettextheight
209         .global _tgi_gettextwidth
210         .global _tgi_getxres
211         .global _tgi_getyres
212         .global _tgi_gotoxy
213         .global _tgi_imulround
214         .global _tgi_init
215         .global _tgi_install
216         .global _tgi_install_vectorfont
217         .global _tgi_ioctl
218         .global _tgi_line
219         .global _tgi_lineto
220         .global _tgi_load_driver
221         .global _tgi_outtext
222         .global _tgi_outtextxy
223         .global _tgi_pieslice
224         .global _tgi_setaspectratio
225         .global _tgi_setcolor
226         .global _tgi_setdrawpage
227         .global _tgi_setpalette
228         .global _tgi_setpixel
229         .global _tgi_settextdir
230         .global _tgi_settextscale
231         .global _tgi_settextstyle
232         .global _tgi_setviewpage
233         .global _tgi_uninstall
234         .global _tgi_unload