2004-10-08 20:23:15 +00:00
|
|
|
;
|
|
|
|
; Stefan Haubenthal, 2004-10-07
|
|
|
|
; Based on code from Pu-239
|
|
|
|
;
|
2012-03-04 13:08:54 +00:00
|
|
|
; unsigned char get_tv (void);
|
2004-10-08 20:23:15 +00:00
|
|
|
; /* Return the video mode the machine is using */
|
|
|
|
;
|
|
|
|
|
2013-05-09 11:56:54 +00:00
|
|
|
.include "vic20.inc"
|
|
|
|
.include "get_tv.inc"
|
2004-10-08 20:23:15 +00:00
|
|
|
|
|
|
|
;--------------------------------------------------------------------------
|
|
|
|
; _get_tv
|
|
|
|
|
2013-05-09 11:56:54 +00:00
|
|
|
.proc _get_tv
|
2004-10-08 20:23:15 +00:00
|
|
|
|
|
|
|
NTSC_LINES = 261
|
2013-05-09 11:56:54 +00:00
|
|
|
; detect the system
|
|
|
|
lda #TV::NTSC
|
|
|
|
tax
|
|
|
|
@L0: ldy VIC_HLINE
|
|
|
|
cpy #1
|
|
|
|
bne @L0 ; wait for line 1
|
|
|
|
@L1: ldy VIC_HLINE
|
|
|
|
beq @L2 ; line 0 reached -> NTSC
|
|
|
|
cpy #NTSC_LINES/2+2
|
|
|
|
bne @L1
|
|
|
|
lda #TV::PAL
|
|
|
|
@L2: rts ; system detected: 0 for NTSC, 1 for PAL
|
2004-10-08 20:23:15 +00:00
|
|
|
|
|
|
|
.endproc
|