TGI Implementation
git-svn-id: svn://svn.cc65.org/cc65/trunk@1312 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
@@ -14,12 +14,15 @@
|
|||||||
C_OBJS =
|
C_OBJS =
|
||||||
|
|
||||||
S_OBJS = tgi-kernel.o \
|
S_OBJS = tgi-kernel.o \
|
||||||
|
tgi_done.o \
|
||||||
tgi_geterror.o \
|
tgi_geterror.o \
|
||||||
tgi_getmaxx.o \
|
tgi_getmaxx.o \
|
||||||
tgi_getmaxy.o \
|
tgi_getmaxy.o \
|
||||||
tgi_getxres.o \
|
tgi_getxres.o \
|
||||||
tgi_getyres.o \
|
tgi_getyres.o \
|
||||||
tgi_map_mode.o
|
tgi_init.o \
|
||||||
|
tgi_map_mode.o \
|
||||||
|
tgi_unload.o
|
||||||
|
|
||||||
|
|
||||||
all: $(C_OBJS) $(S_OBJS)
|
all: $(C_OBJS) $(S_OBJS)
|
||||||
|
|||||||
@@ -6,6 +6,9 @@
|
|||||||
|
|
||||||
.include "tgi-kernel.inc"
|
.include "tgi-kernel.inc"
|
||||||
|
|
||||||
|
.importzp ptr1
|
||||||
|
|
||||||
|
|
||||||
;----------------------------------------------------------------------------
|
;----------------------------------------------------------------------------
|
||||||
; Variables
|
; Variables
|
||||||
|
|
||||||
@@ -13,10 +16,11 @@
|
|||||||
|
|
||||||
_tgi_drv: .res 2 ; Pointer to driver
|
_tgi_drv: .res 2 ; Pointer to driver
|
||||||
_tgi_error: .res 1 ; Last error code
|
_tgi_error: .res 1 ; Last error code
|
||||||
|
_tgi_mode: .res 1 ; Graphics mode or zero
|
||||||
|
|
||||||
|
|
||||||
.data
|
.data
|
||||||
|
|
||||||
; Jump table for the driver functions.
|
; Jump table for the driver functions.
|
||||||
|
|
||||||
tgi_install: jmp $0000
|
tgi_install: jmp $0000
|
||||||
@@ -52,11 +56,14 @@ tgi_setup:
|
|||||||
lda (ptr1),y
|
lda (ptr1),y
|
||||||
sta tgi_install,x
|
sta tgi_install,x
|
||||||
inx
|
inx
|
||||||
cpx #(TGI_HDR_JMPCOUNT*3)
|
cpx #(TGI_HDR_JUMPCOUNT*3)
|
||||||
bne @L1
|
bne @L1
|
||||||
|
|
||||||
|
; Initialize variables
|
||||||
|
|
||||||
lda #$00
|
lda #$00
|
||||||
sta _tgi_error
|
sta _tgi_error
|
||||||
|
sta _tgi_mode
|
||||||
|
|
||||||
jsr tgi_install ; Call driver install routine
|
jsr tgi_install ; Call driver install routine
|
||||||
|
|
||||||
|
|||||||
22
libsrc/tgi/tgi_done.s
Normal file
22
libsrc/tgi/tgi_done.s
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
;
|
||||||
|
; Ullrich von Bassewitz, 21.06.2002
|
||||||
|
;
|
||||||
|
; void __fastcall__ tgi_done (void);
|
||||||
|
; /* End graphics mode, switch back to text mode. Will NOT unload the driver! */
|
||||||
|
|
||||||
|
.include "tgi-kernel.inc"
|
||||||
|
|
||||||
|
.export _tgi_done
|
||||||
|
|
||||||
|
_tgi_done:
|
||||||
|
lda _tgi_mode ; Is a graphics mode active?
|
||||||
|
beq @L1 ; Jump if not
|
||||||
|
jsr tgi_done ; Call the driver routine
|
||||||
|
jsr tgi_fetch_error ; Get the error code
|
||||||
|
lda _tgi_error ; Did we have an error?
|
||||||
|
bne @L1 ; Jump if yes
|
||||||
|
sta _tgi_mode ; Reset the current mode
|
||||||
|
@L1: rts
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -2,12 +2,16 @@
|
|||||||
; Ullrich von Bassewitz, 21.06.2002
|
; Ullrich von Bassewitz, 21.06.2002
|
||||||
;
|
;
|
||||||
; unsigned char __fastcall__ tgi_geterror (void);
|
; unsigned char __fastcall__ tgi_geterror (void);
|
||||||
; /* Return the error code for the last operation. */
|
; /* Return the error code for the last operation. This will also clear the
|
||||||
|
; * error.
|
||||||
|
; */
|
||||||
|
|
||||||
.include "tgi-kernel.inc"
|
.include "tgi-kernel.inc"
|
||||||
|
|
||||||
|
|
||||||
_tgi_geterror:
|
_tgi_geterror:
|
||||||
|
ldx #0
|
||||||
lda _tgi_error
|
lda _tgi_error
|
||||||
|
stx _tgi_error
|
||||||
rts
|
rts
|
||||||
|
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
.include "tgi-kernel.inc"
|
.include "tgi-kernel.inc"
|
||||||
.export _tgi_getmaxy
|
.export _tgi_getmaxy
|
||||||
.import _tgi_getyres
|
.import _tgi_getyres
|
||||||
.import decax
|
.import decax1
|
||||||
|
|
||||||
|
|
||||||
_tgi_getmaxy:
|
_tgi_getmaxy:
|
||||||
|
|||||||
24
libsrc/tgi/tgi_init.s
Normal file
24
libsrc/tgi/tgi_init.s
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
;
|
||||||
|
; Ullrich von Bassewitz, 21.06.2002
|
||||||
|
;
|
||||||
|
; void __fastcall__ tgi_init (unsigned char mode);
|
||||||
|
; /* Initialize the given graphics mode. */
|
||||||
|
|
||||||
|
|
||||||
|
.include "tgi-kernel.inc"
|
||||||
|
.include "tgi-error.inc"
|
||||||
|
|
||||||
|
.import _tgi_done
|
||||||
|
.export _tgi_init
|
||||||
|
|
||||||
|
_tgi_init:
|
||||||
|
pha ; Save mode
|
||||||
|
jsr _tgi_done ; Switch off graphics if needed
|
||||||
|
jsr tgi_init ; Initialize the mode
|
||||||
|
jsr tgi_fetch_error ; Get the error code
|
||||||
|
pla ; Restore the mode
|
||||||
|
ldx _tgi_error ; Did we have an error before?
|
||||||
|
bne @L1 ; Jump if yes
|
||||||
|
sta _tgi_mode ; Set the current mode if not
|
||||||
|
@L1: rts
|
||||||
|
|
||||||
32
libsrc/tgi/tgi_unload.s
Normal file
32
libsrc/tgi/tgi_unload.s
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
;
|
||||||
|
; Ullrich von Bassewitz, 21.06.2002
|
||||||
|
;
|
||||||
|
; void __fastcall__ tgi_unload (void);
|
||||||
|
; /* Unload the currently loaded driver. */
|
||||||
|
|
||||||
|
|
||||||
|
.include "tgi-kernel.inc"
|
||||||
|
.include "modload.inc"
|
||||||
|
|
||||||
|
.import _tgi_done
|
||||||
|
.export _tgi_unload
|
||||||
|
|
||||||
|
|
||||||
|
_tgi_unload:
|
||||||
|
jsr _tgi_done ; Switch off graphics
|
||||||
|
jsr tgi_deinstall ; Allow the driver to clean up
|
||||||
|
|
||||||
|
lda _tgi_drv
|
||||||
|
ldx _tgi_drv+1
|
||||||
|
jsr _mod_free ; Free the driver
|
||||||
|
|
||||||
|
; Clear variables
|
||||||
|
|
||||||
|
lda #$00
|
||||||
|
sta _tgi_drv
|
||||||
|
sta _tgi_drv+1
|
||||||
|
sta _tgi_error
|
||||||
|
|
||||||
|
rts
|
||||||
|
|
||||||
|
|
||||||
Reference in New Issue
Block a user