From dd6ce2fdddbc9f988f1bcc52cbedca6c0a24f99d Mon Sep 17 00:00:00 2001 From: cuz Date: Fri, 8 Oct 2004 20:23:15 +0000 Subject: [PATCH] New get_tv function from Stefan Haubenthal git-svn-id: svn://svn.cc65.org/cc65/trunk@3230 b7a2c559-68d2-44c3-8de9-860c34a00d81 --- libsrc/vic20/get_tv.s | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 libsrc/vic20/get_tv.s diff --git a/libsrc/vic20/get_tv.s b/libsrc/vic20/get_tv.s new file mode 100644 index 000000000..13c5c428a --- /dev/null +++ b/libsrc/vic20/get_tv.s @@ -0,0 +1,33 @@ +; +; Stefan Haubenthal, 2004-10-07 +; Based on code from Pu-239 +; +; unsigned char __fastcall__ get_tv (void); +; /* Return the video mode the machine is using */ +; + + .export _get_tv + + .include "vic20.inc" + + +;-------------------------------------------------------------------------- +; _get_tv + +.proc _get_tv + +NTSC_LINES = 261 + ; detect the system + lda #0 + 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 #1 +@L2: rts ; system detected: 0 for NTSC, 1 for PAL + +.endproc -- 2.39.5