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_xres: .res 2 ; X resolution of the current mode
23 _tgi_yres: .res 2 ; Y resolution of the current mode
24 _tgi_colors: .res 1 ; Number of available colors
25 _tgi_pagecount: .res 1 ; Number of available screen pages
30 ; Jump table for the driver functions.
32 tgi_install: jmp $0000
33 tgi_deinstall: jmp $0000
36 tgi_control: jmp $0000
38 tgi_setviewpage:jmp $0000
39 tgi_setdrawpage:jmp $0000
40 tgi_setcolor: jmp $0000
41 tgi_setpixel: jmp $0000
42 tgi_getpixel: jmp $0000
48 ;----------------------------------------------------------------------------
49 ; void __fastcall__ tgi_setup (void);
50 ; /* Setup the driver and graphics kernel once the driver is loaded */
61 jsr tgi_set_ptr ; load _tgi_drv into ptr1
63 ; Copy the jump vectors
67 @L1: inx ; Skip JMP opcode
68 jsr copy ; Copy one byte
69 jsr copy ; Copy one byte
70 cpx #(TGI_HDR_JUMPCOUNT*3)
73 ; Check for emulation vectors needed
76 ora tgi_bar+2 ; Do we have a BAR vector?
78 lda #<tgi_emu_bar ; Use emulation if no
83 ; Copy variables. Beware: We are using internal knowledge about variable
86 @L2: ldy #TGI_HDR_XRES
95 ; Initialize variables
101 jsr tgi_install ; Call driver install routine
103 ; jmp tgi_fetch_error
105 ;----------------------------------------------------------------------------
106 ; Fetch the error code from the driver and place it into the global error
107 ; variable. The function will also return the error in A and the flags from
108 ; loading the error code are set.
117 ;----------------------------------------------------------------------------
118 ; Load the pointer to the tgi driver into ptr1.
127 ;----------------------------------------------------------------------------
128 ; Set an invalid argument error