]> git.sur5r.net Git - cc65/commitdiff
Added DTV detection code by Marco van den Heuvel.
authoruz <uz@b7a2c559-68d2-44c3-8de9-860c34a00d81>
Thu, 4 Feb 2010 20:27:48 +0000 (20:27 +0000)
committeruz <uz@b7a2c559-68d2-44c3-8de9-860c34a00d81>
Thu, 4 Feb 2010 20:27:48 +0000 (20:27 +0000)
git-svn-id: svn://svn.cc65.org/cc65/trunk@4580 b7a2c559-68d2-44c3-8de9-860c34a00d81

libsrc/c64/dtv-himem.s

index 6be79a9f808e52df20da7e1047146a70dc4149a5..72a6bdc7a20c828c5e765e7c66ae8e69e7c86103 100644 (file)
@@ -5,10 +5,12 @@
 ; Ullrich von Bassewitz, 2005-11-27
 ;
 
+
        .include        "zeropage.inc"
 
        .include        "em-kernel.inc"
         .include        "em-error.inc"
+       .import _get_ostype
 
 
         .macpack        generic
@@ -71,8 +73,26 @@ curpage:        .word        $0000           ; Page
 ;
 
 INSTALL:
-        lda     #$01
-        sta     $d03f                   ; Enable extended register access
+
+; Check for a DTV
+
+        ldx     #1
+        stx     $d03f
+        ldx     $d040
+        cpx     $d000
+        bne     @present
+        inc     $d000
+        cpx     $d040
+        beq     @present
+        dec     $d000
+
+; DTV not found
+
+        lda     #<EM_ERR_NO_DEVICE
+        ldx     #>EM_ERR_NO_DEVICE
+        rts
+
+@present:
         ldx     #$FF
         stx     curpage+1               ; Invalidate curpage
         inx                             ; X = 0