]> git.sur5r.net Git - cc65/blob - libsrc/tgi/tgi_unload.s
Relocate register values outside structs, + more
[cc65] / libsrc / tgi / tgi_unload.s
1 ;
2 ; Ullrich von Bassewitz, 21.06.2002
3 ;
4 ; void tgi_unload (void);
5 ; /* Unload the currently loaded driver. */
6
7
8         .include        "tgi-kernel.inc"
9         .include        "tgi-error.inc"
10         .include        "modload.inc"
11
12
13 _tgi_unload:
14
15         lda     _tgi_drv
16         ora     _tgi_drv
17         beq     no_driver               ; No driver
18
19         lda     _tgi_drv
20         pha
21         lda     _tgi_drv+1
22         pha                             ; Save pointer to driver
23
24         jsr     _tgi_uninstall          ; Uninstall the driver
25
26         pla
27         tax
28         pla
29         jmp     _mod_free               ; Free the driver
30
31 no_driver:
32         lda     #<TGI_ERR_NO_DRIVER
33         sta     _tgi_error
34         rts