1
0
mirror of https://github.com/cc65/cc65.git synced 2024-06-07 07:29:33 +00:00

Simpler get_tv

You don't have to count the beam, just check the KERNAL.
This commit is contained in:
Stefan 2018-04-10 18:37:10 +00:00 committed by GitHub
parent 60b9ea3222
commit a50d214ffb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,12 +1,11 @@
; ;
; Stefan Haubenthal, 2004-10-07 ; Stefan Haubenthal, 2018-04-10
; Based on code from Pu-239 ; Based on code by Mike
; ;
; unsigned char get_tv (void); ; unsigned char get_tv (void);
; /* Return the video mode the machine is using */ ; /* Return the video mode the machine is using */
; ;
.include "vic20.inc"
.include "get_tv.inc" .include "get_tv.inc"
;-------------------------------------------------------------------------- ;--------------------------------------------------------------------------
@ -14,18 +13,13 @@
.proc _get_tv .proc _get_tv
NTSC_LINES = 261
; detect the system ; detect the system
lda #TV::NTSC lda #TV::NTSC
tax tax
@L0: ldy VIC_HLINE ldy $EDE4 ; VIC init table
cpy #1 cpy #5
bne @L0 ; wait for line 1 beq @L0
@L1: ldy VIC_HLINE
beq @L2 ; line 0 reached -> NTSC
cpy #NTSC_LINES/2+2
bne @L1
lda #TV::PAL lda #TV::PAL
@L2: rts ; system detected: 0 for NTSC, 1 for PAL @L0: rts ; system detected: 0 for NTSC, 1 for PAL
.endproc .endproc