Use the new TGI_HDR structure.

Added an interrupt entry point for the drivers.
Rewrote tgi_unload to avoid problems with the tgi_drv pointer.


git-svn-id: svn://svn.cc65.org/cc65/trunk@3284 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
cuz
2004-11-07 11:30:26 +00:00
parent 3088254f57
commit 8b0c3d3425
2 changed files with 51 additions and 33 deletions

View File

@@ -6,20 +6,31 @@
.include "tgi-kernel.inc"
.include "tgi-error.inc"
.include "modload.inc"
.import tgi_clear_ptr
.proc _tgi_unload
jsr _tgi_done ; Switch off graphics
jsr tgi_uninstall ; Allow the driver to clean up
_tgi_unload:
lda _tgi_drv
ldx _tgi_drv+1
jsr _mod_free ; Free the driver
ora _tgi_drv
beq no_driver ; No driver
jmp tgi_clear_ptr ; Clear the driver pointer and exit
lda _tgi_drv
pha
lda _tgi_drv+1
pha ; Save pointer to driver
jsr _tgi_uninstall ; Uninstall the driver
pla
tax
pla
jmp _mod_free ; Free the driver
no_driver:
lda #<TGI_ERR_NO_DRIVER
sta _tgi_error
rts
.endproc