File: get_tv.s

package info (click to toggle)
cc65 2.19-2
  • links: PTS
  • area: main
  • in suites: forky, sid, trixie
  • size: 20,268 kB
  • sloc: ansic: 117,151; asm: 66,339; pascal: 4,248; makefile: 1,009; perl: 607
file content (37 lines) | stat: -rw-r--r-- 837 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
;
; Stefan Haubenthal, 2007-01-21
;
; unsigned char get_tv (void);
; /* Return the video mode the machine is using */
;

        .include        "nes.inc"
        .include        "get_tv.inc"
        .importzp       tmp1, tmp2

;--------------------------------------------------------------------------
; _get_tv

.proc   _get_tv

        lda     #TV::NTSC       ; assume NTSC
        tax                     ; clear
        sta     tmp1
        sta     tmp2
        ldy     tickcount
wait:   cpy     tickcount
        beq     wait
        iny                     ; next tick
loop:   cpy     tickcount
        bne     over
        inc     tmp1
        bne     loop
        inc     tmp2
        bne     loop
over:   ldy     tmp2
        cpy     #9
        bcc     nopal
        lda     #TV::PAL        ; choose PAL
nopal:  rts

.endproc