2002-06-21 12:00:45 +00:00
|
|
|
;*****************************************************************************/
|
|
|
|
;* */
|
|
|
|
;* tgi-kernel.inc */
|
|
|
|
;* */
|
|
|
|
;* TGI kernel interface */
|
|
|
|
;* */
|
|
|
|
;* */
|
|
|
|
;* */
|
2012-07-22 11:07:46 +00:00
|
|
|
;* (C) 2002-2012, Ullrich von Bassewitz */
|
2009-10-30 21:26:35 +00:00
|
|
|
;* Roemerstrasse 52 */
|
|
|
|
;* D-70794 Filderstadt */
|
|
|
|
;* EMail: uz@cc65.org */
|
2002-06-21 12:00:45 +00:00
|
|
|
;* */
|
|
|
|
;* */
|
|
|
|
;* This software is provided 'as-is', without any expressed or implied */
|
|
|
|
;* warranty. In no event will the authors be held liable for any damages */
|
|
|
|
;* arising from the use of this software. */
|
|
|
|
;* */
|
|
|
|
;* Permission is granted to anyone to use this software for any purpose, */
|
|
|
|
;* including commercial applications, and to alter it and redistribute it */
|
|
|
|
;* freely, subject to the following restrictions: */
|
|
|
|
;* */
|
|
|
|
;* 1. The origin of this software must not be misrepresented; you must not */
|
|
|
|
;* claim that you wrote the original software. If you use this software */
|
|
|
|
;* in a product, an acknowledgment in the product documentation would be */
|
|
|
|
;* appreciated but is not required. */
|
|
|
|
;* 2. Altered source versions must be plainly marked as such, and must not */
|
|
|
|
;* be misrepresented as being the original software. */
|
|
|
|
;* 3. This notice may not be removed or altered from any source */
|
|
|
|
;* distribution. */
|
|
|
|
;* */
|
|
|
|
;*****************************************************************************/
|
|
|
|
|
|
|
|
|
|
|
|
|
2002-06-21 12:46:52 +00:00
|
|
|
;------------------------------------------------------------------------------
|
2004-11-07 11:30:45 +00:00
|
|
|
; The driver header
|
2002-06-21 12:46:52 +00:00
|
|
|
|
2004-11-07 11:30:45 +00:00
|
|
|
.struct TGI_HDR
|
|
|
|
ID .byte 3 ; Contains 0x74, 0x67, 0x69 ("tgi")
|
|
|
|
VERSION .byte 1 ; Interface version
|
2013-06-01 10:42:00 +00:00
|
|
|
LIBREF .addr ; Library reference
|
2004-11-07 11:30:45 +00:00
|
|
|
VARS .struct
|
|
|
|
XRES .word 1 ; X resolution
|
|
|
|
YRES .word 1 ; Y resolution
|
|
|
|
COLORCOUNT .byte 1 ; Number of available colors
|
|
|
|
PAGECOUNT .byte 1 ; Number of screens available
|
2011-07-17 11:23:27 +00:00
|
|
|
FONTWIDTH .byte 1 ; System font width in pixel
|
|
|
|
FONTHEIGHT .byte 1 ; System font height in pixel
|
2009-10-29 20:13:56 +00:00
|
|
|
ASPECTRATIO .word 1 ; Fixed point 8.8 format
|
2011-07-17 11:23:27 +00:00
|
|
|
FLAGS .byte 1 ; TGI driver flags
|
2004-11-07 11:30:45 +00:00
|
|
|
.endstruct
|
|
|
|
JUMPTAB .struct
|
|
|
|
INSTALL .addr ; INSTALL routine
|
|
|
|
UNINSTALL .addr ; UNINSTALL routine
|
|
|
|
INIT .addr ; INIT routine
|
|
|
|
DONE .addr ; DONE routine
|
2013-05-09 11:56:54 +00:00
|
|
|
GETERROR .addr ; GETERROR routine
|
2004-11-07 11:30:45 +00:00
|
|
|
CONTROL .addr ; CONTROL routine
|
|
|
|
CLEAR .addr ; CLEAR routine
|
|
|
|
SETVIEWPAGE .addr ; SETVIEWPAGE routine
|
|
|
|
SETDRAWPAGE .addr ; SETDRAWPAGE routine
|
|
|
|
SETCOLOR .addr ; SETCOLOR routine
|
|
|
|
SETPALETTE .addr ; SETPALETTE routine
|
|
|
|
GETPALETTE .addr ; GETPALETTE routine
|
|
|
|
GETDEFPALETTE .addr ; GETDEFPALETTE routine
|
|
|
|
SETPIXEL .addr ; SETPIXEL routine
|
|
|
|
GETPIXEL .addr ; GETPIXEL routine
|
|
|
|
LINE .addr ; LINE routine
|
|
|
|
BAR .addr ; BAR routine
|
|
|
|
TEXTSTYLE .addr ; TEXTSTYLE routine
|
|
|
|
OUTTEXT .addr ; OUTTEXT routine
|
|
|
|
.endstruct
|
|
|
|
.endstruct
|
2002-10-03 11:18:49 +00:00
|
|
|
|
2003-10-23 09:04:39 +00:00
|
|
|
;------------------------------------------------------------------------------
|
|
|
|
; The TGI API version, stored at TGI_HDR_VERSION
|
|
|
|
|
2018-02-02 17:15:45 +00:00
|
|
|
TGI_API_VERSION = $06
|
2011-07-17 11:23:27 +00:00
|
|
|
|
|
|
|
;------------------------------------------------------------------------------
|
|
|
|
; Bitmapped tgi driver flags, stored in TGI_HDR::VARS::FLAGS.
|
|
|
|
; Beware: Some of the bits are tested using the BIT instruction, so do not
|
|
|
|
; change the values without checking the code!
|
|
|
|
|
|
|
|
TGI_BM_FONT_FINESCALE = $80 ; Bitmap fonts are fine grained scalable
|
2003-10-23 09:04:39 +00:00
|
|
|
|
2002-10-03 11:18:49 +00:00
|
|
|
;------------------------------------------------------------------------------
|
2011-04-25 17:11:23 +00:00
|
|
|
; Text constants
|
2009-11-01 22:32:14 +00:00
|
|
|
|
|
|
|
TGI_FONT_BITMAP = 0
|
|
|
|
TGI_FONT_VECTOR = 1
|
2002-10-03 11:18:49 +00:00
|
|
|
|
|
|
|
TGI_TEXT_HORIZONTAL = 0
|
2011-05-01 18:40:38 +00:00
|
|
|
TGI_TEXT_VERTICAL = 1
|
2009-11-12 18:01:11 +00:00
|
|
|
|
|
|
|
;----------------------------------------------------------------------------
|
|
|
|
; Results of tgi_outcode
|
|
|
|
|
|
|
|
TGI_CLIP_NONE = $00
|
|
|
|
TGI_CLIP_LEFT = $01
|
|
|
|
TGI_CLIP_RIGHT = $02
|
|
|
|
TGI_CLIP_BOTTOM = $04
|
|
|
|
TGI_CLIP_TOP = $08
|
2002-06-21 12:46:52 +00:00
|
|
|
|
|
|
|
;------------------------------------------------------------------------------
|
2011-04-25 17:11:23 +00:00
|
|
|
; ASM accessible color constants
|
|
|
|
|
2013-05-09 11:56:54 +00:00
|
|
|
.global tgi_color_black:zp ; Target-specific value for black
|
|
|
|
.global tgi_color_white:zp ; Target-specific value for white
|
2011-04-25 17:11:23 +00:00
|
|
|
|
|
|
|
;------------------------------------------------------------------------------
|
|
|
|
; C accessible variables
|
2002-06-21 12:46:52 +00:00
|
|
|
|
2013-05-09 11:56:54 +00:00
|
|
|
.global _tgi_drv ; Pointer to driver
|
|
|
|
.global _tgi_error ; Last error code
|
2002-12-29 20:59:34 +00:00
|
|
|
.global _tgi_gmode ; Flag: graphics mode active
|
2002-06-22 21:40:24 +00:00
|
|
|
.global _tgi_curx ; Current drawing cursor X
|
|
|
|
.global _tgi_cury ; Current drawing cursor Y
|
|
|
|
.global _tgi_color ; Current drawing color
|
2009-11-02 22:29:49 +00:00
|
|
|
.global _tgi_font ; Which font to use
|
2002-10-03 11:18:49 +00:00
|
|
|
.global _tgi_textdir ; Current text direction
|
2009-11-06 16:18:13 +00:00
|
|
|
.global _tgi_vectorfont ; Pointer to vector font
|
2009-11-02 22:29:49 +00:00
|
|
|
.global _tgi_textscalew ; Text magnification for the width
|
|
|
|
.global _tgi_textscaleh ; Text magnification for the height
|
2009-10-30 21:26:35 +00:00
|
|
|
.global _tgi_charwidth ; Width of scaled system font char
|
|
|
|
.global _tgi_charheight ; Height of scaled system font char
|
2002-06-21 21:15:46 +00:00
|
|
|
.global _tgi_xres ; X resolution of the current mode
|
2002-06-22 21:40:24 +00:00
|
|
|
.global _tgi_yres ; Y resolution of the current mode
|
2009-11-06 16:00:43 +00:00
|
|
|
.global _tgi_xmax ; Maximum X coordinate
|
|
|
|
.global _tgi_ymax ; Maximum Y coordinate
|
2002-06-22 21:40:24 +00:00
|
|
|
.global _tgi_colorcount ; Number of available colors
|
|
|
|
.global _tgi_pagecount ; Number of available screen pages
|
2009-10-30 21:26:35 +00:00
|
|
|
.global _tgi_fontwidth ; System font width
|
|
|
|
.global _tgi_fontheight ; System font height
|
2009-10-29 20:13:56 +00:00
|
|
|
.global _tgi_aspectratio ; Aspect ratio, fixed point 8.8
|
2011-07-17 18:36:12 +00:00
|
|
|
.global _tgi_flags ; TGI driver flags
|
2002-06-21 12:46:52 +00:00
|
|
|
|
2009-11-06 16:00:43 +00:00
|
|
|
;------------------------------------------------------------------------------
|
2011-04-25 17:11:23 +00:00
|
|
|
; ASM accessible variables
|
2009-11-06 16:00:43 +00:00
|
|
|
|
2013-05-09 11:56:54 +00:00
|
|
|
.global tgi_clip_x1 ; Coordinate for line clipper
|
|
|
|
.global tgi_clip_y1 ; Coordinate for line clipper
|
|
|
|
.global tgi_clip_x2 ; Coordinate for line clipper
|
|
|
|
.global tgi_clip_y2 ; Coordinate for line clipper
|
2009-11-06 16:00:43 +00:00
|
|
|
|
2002-06-21 12:46:52 +00:00
|
|
|
;------------------------------------------------------------------------------
|
|
|
|
; Driver entry points
|
|
|
|
|
|
|
|
.global tgi_install
|
2003-02-11 12:37:46 +00:00
|
|
|
.global tgi_uninstall
|
2002-06-21 12:46:52 +00:00
|
|
|
.global tgi_init
|
2002-06-21 14:16:32 +00:00
|
|
|
.global tgi_done
|
2013-05-09 11:56:54 +00:00
|
|
|
.global tgi_geterror
|
2002-06-21 12:46:52 +00:00
|
|
|
.global tgi_control
|
|
|
|
.global tgi_clear
|
2002-06-22 21:40:24 +00:00
|
|
|
.global tgi_setviewpage
|
|
|
|
.global tgi_setdrawpage
|
2002-06-21 12:46:52 +00:00
|
|
|
.global tgi_setcolor
|
2002-07-07 10:30:31 +00:00
|
|
|
.global tgi_setpalette
|
|
|
|
.global tgi_getpalette
|
|
|
|
.global tgi_getdefpalette
|
2002-06-21 12:46:52 +00:00
|
|
|
.global tgi_setpixel
|
|
|
|
.global tgi_getpixel
|
|
|
|
.global tgi_line
|
|
|
|
.global tgi_bar
|
2002-10-03 11:18:49 +00:00
|
|
|
.global tgi_textstyle
|
|
|
|
.global tgi_outtext
|
2002-06-21 12:46:52 +00:00
|
|
|
|
|
|
|
;------------------------------------------------------------------------------
|
|
|
|
; ASM functions
|
2002-06-21 12:00:45 +00:00
|
|
|
|
2012-07-22 11:07:46 +00:00
|
|
|
.global tgi_clear_ptr
|
2009-11-06 16:00:43 +00:00
|
|
|
.global tgi_clippedline
|
|
|
|
.global tgi_curtoxy
|
2002-06-22 21:40:24 +00:00
|
|
|
.global tgi_getset
|
2009-11-12 18:01:11 +00:00
|
|
|
.global tgi_imulround
|
2002-06-22 21:40:24 +00:00
|
|
|
.global tgi_inv_arg
|
2003-02-11 12:37:46 +00:00
|
|
|
.global tgi_inv_drv
|
2002-06-22 21:40:24 +00:00
|
|
|
.global tgi_linepop
|
2009-11-12 18:01:11 +00:00
|
|
|
.global tgi_outcode
|
2002-10-03 11:18:49 +00:00
|
|
|
.global tgi_popxy
|
|
|
|
.global tgi_popxy2
|
2009-11-06 16:00:43 +00:00
|
|
|
.global tgi_set_ptr
|
2002-10-03 11:18:49 +00:00
|
|
|
|
2003-02-11 12:37:46 +00:00
|
|
|
;------------------------------------------------------------------------------
|
|
|
|
; C callable functions
|
|
|
|
|
2009-11-05 19:52:18 +00:00
|
|
|
.global _tgi_arc
|
|
|
|
.global _tgi_bar
|
|
|
|
.global _tgi_circle
|
|
|
|
.global _tgi_clear
|
2003-02-11 12:37:46 +00:00
|
|
|
.global _tgi_done
|
2009-11-05 19:52:18 +00:00
|
|
|
.global _tgi_ellipse
|
2013-05-09 11:56:54 +00:00
|
|
|
.global _tgi_getaspectratio
|
2009-11-05 19:52:18 +00:00
|
|
|
.global _tgi_getcolor
|
|
|
|
.global _tgi_getcolorcount
|
|
|
|
.global _tgi_getdefpalette
|
2003-02-11 12:37:46 +00:00
|
|
|
.global _tgi_geterror
|
2004-06-15 09:08:39 +00:00
|
|
|
.global _tgi_geterrormsg
|
2003-02-11 12:37:46 +00:00
|
|
|
.global _tgi_getmaxcolor
|
|
|
|
.global _tgi_getmaxx
|
|
|
|
.global _tgi_getmaxy
|
2009-11-05 19:52:18 +00:00
|
|
|
.global _tgi_getpagecount
|
|
|
|
.global _tgi_getpalette
|
2003-02-11 12:37:46 +00:00
|
|
|
.global _tgi_getpixel
|
2011-07-17 18:36:12 +00:00
|
|
|
.global _tgi_gettextheight
|
|
|
|
.global _tgi_gettextwidth
|
2009-11-05 19:52:18 +00:00
|
|
|
.global _tgi_getxres
|
|
|
|
.global _tgi_getyres
|
2003-02-11 12:37:46 +00:00
|
|
|
.global _tgi_gotoxy
|
2009-11-05 20:16:43 +00:00
|
|
|
.global _tgi_imulround
|
2009-11-05 19:52:18 +00:00
|
|
|
.global _tgi_init
|
|
|
|
.global _tgi_install
|
2009-11-06 16:18:13 +00:00
|
|
|
.global _tgi_install_vectorfont
|
2009-11-05 19:52:18 +00:00
|
|
|
.global _tgi_ioctl
|
2003-02-11 12:37:46 +00:00
|
|
|
.global _tgi_line
|
|
|
|
.global _tgi_lineto
|
2009-11-05 19:52:18 +00:00
|
|
|
.global _tgi_load_driver
|
|
|
|
.global _tgi_outtext
|
|
|
|
.global _tgi_outtextxy
|
2011-05-02 19:18:38 +00:00
|
|
|
.global _tgi_pieslice
|
2013-05-09 11:56:54 +00:00
|
|
|
.global _tgi_setaspectratio
|
2009-11-05 19:52:18 +00:00
|
|
|
.global _tgi_setcolor
|
|
|
|
.global _tgi_setdrawpage
|
|
|
|
.global _tgi_setpalette
|
|
|
|
.global _tgi_setpixel
|
2011-07-31 22:17:21 +00:00
|
|
|
.global _tgi_settextdir
|
2011-07-17 18:36:12 +00:00
|
|
|
.global _tgi_settextscale
|
|
|
|
.global _tgi_settextstyle
|
2009-11-05 19:52:18 +00:00
|
|
|
.global _tgi_setviewpage
|
|
|
|
.global _tgi_uninstall
|
|
|
|
.global _tgi_unload
|