]> git.sur5r.net Git - cc65/blob - libsrc/nes/get_tv.s
Removed (pretty inconsistently used) tab chars from source code base.
[cc65] / libsrc / nes / get_tv.s
1 ;
2 ; Stefan Haubenthal, 2007-01-21
3 ;
4 ; unsigned char get_tv (void);
5 ; /* Return the video mode the machine is using */
6 ;
7
8         .include        "nes.inc"
9         .include        "get_tv.inc"
10         .importzp       tmp1, tmp2
11
12 ;--------------------------------------------------------------------------
13 ; _get_tv
14
15 .proc   _get_tv
16
17         lda     #TV::NTSC       ; assume NTSC
18         tax                     ; clear
19         sta     tmp1
20         sta     tmp2
21         ldy     tickcount
22 wait:   cpy     tickcount
23         beq     wait
24         iny                     ; next tick
25 loop:   cpy     tickcount
26         bne     over
27         inc     tmp1
28         bne     loop
29         inc     tmp2
30         bne     loop
31 over:   ldy     tmp2
32         cpy     #9
33         bcc     nopal
34         lda     #TV::PAL        ; choose PAL
35 nopal:  rts
36
37 .endproc