]> git.sur5r.net Git - cc65/blob - libsrc/tgi/tgi_map_mode.s
remove superfluous ".code" line
[cc65] / libsrc / tgi / tgi_map_mode.s
1 ;
2 ; Ullrich von Bassewitz, 31.05.2002
3 ;
4 ; const char* __fastcall__ tgi_map_mode (unsigned char mode);
5 ; /* Map tgi mode codes to driver names */
6 ;
7
8         .export         _tgi_map_mode
9         .import         _tgi_mode_table
10         .import         return0
11         .importzp       tmp1
12
13 ;----------------------------------------------------------------------------
14 ; BEWARE: The current implementation of tgi_map_mode does not work with tables
15 ; larger that 255 bytes!
16
17 .code
18
19 .proc   _tgi_map_mode
20
21         sta     tmp1                    ; Save mode
22         ldy     #$00
23
24 @L0:    lda     _tgi_mode_table,y
25         beq     NotFound                ; Branch if mode code zero
26         cmp     tmp1
27         beq     Found
28
29 ; Skip the name
30
31 @L1:    iny
32         lda     _tgi_mode_table,y
33         bne     @L1                     ; Loop until end marker found
34         iny                             ; Skip end marker
35         bne     @L0                     ; Branch always
36
37 ; Mode not found
38
39 NotFound:
40         jmp     return0
41
42 ; Mode found
43
44 Found:  tya
45         ldx     #>_tgi_mode_table
46         sec                             ; Account for the mode byte
47         adc     #<_tgi_mode_table       ; Return pointer to file name
48         bcc     @L1
49         inx
50 @L1:    rts
51
52 .endproc
53
54