2 ; Ullrich von Bassewitz, 21.06.2002
4 ; Common functions of the tgi graphics kernel.
7 .include "tgi-kernel.inc"
8 .include "tgi-error.inc"
14 ;----------------------------------------------------------------------------
19 _tgi_drv: .res 2 ; Pointer to driver
20 _tgi_error: .res 1 ; Last error code
21 _tgi_mode: .res 1 ; Graphics mode or zero
22 _tgi_curx: .res 2 ; Current drawing cursor X
23 _tgi_cury: .res 2 ; Current drawing cursor Y
24 _tgi_color: .res 1 ; Current drawing color
25 _tgi_xres: .res 2 ; X resolution of the current mode
26 _tgi_yres: .res 2 ; Y resolution of the current mode
27 _tgi_colorcount: .res 1 ; Number of available colors
28 _tgi_pagecount: .res 1 ; Number of available screen pages
33 ; Jump table for the driver functions.
35 tgi_install: jmp $0000
36 tgi_deinstall: jmp $0000
39 tgi_geterror: jmp $0000
40 tgi_control: jmp $0000
42 tgi_setviewpage: jmp $0000
43 tgi_setdrawpage: jmp $0000
44 tgi_setcolor: jmp $0000
45 tgi_setpalette: jmp $0000
46 tgi_getpalette: jmp $0000
47 tgi_getdefpalette: jmp $0000
48 tgi_setpixel: jmp $0000
49 tgi_getpixel: jmp $0000
50 tgi_horline: jmp $0000
56 ;----------------------------------------------------------------------------
57 ; void __fastcall__ tgi_setup (void);
58 ; /* Setup the driver and graphics kernel once the driver is loaded */
69 jsr tgi_set_ptr ; load _tgi_drv into ptr1
71 ; Copy the jump vectors
75 @L1: inx ; Skip JMP opcode
76 jsr copy ; Copy one byte
77 jsr copy ; Copy one byte
78 cpx #(TGI_HDR_JUMPCOUNT*3)
81 ; Check for emulation vectors needed
84 ora tgi_bar+2 ; Do we have a BAR vector?
86 lda #<tgi_emu_bar ; Use emulation if no
91 ; Copy variables. Beware: We are using internal knowledge about variable
94 @L2: ldy #TGI_HDR_XRES
103 ; Initialize variables
107 @L4: sta _tgi_error,x ; Clear error/mode/curx/cury
111 jmp tgi_install ; Call driver install routine
113 ;----------------------------------------------------------------------------
114 ; Load the pointer to the tgi driver into ptr1.
123 ;----------------------------------------------------------------------------
124 ; Set an invalid argument error