From: uz Date: Mon, 1 Feb 2010 07:15:41 +0000 (+0000) Subject: Added size checking code contributed by Marco van den Heuvel. X-Git-Tag: V2.13.2~35 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=3bf4afae5030d44b60c8b63955fe32e08ab95825;p=cc65 Added size checking code contributed by Marco van den Heuvel. git-svn-id: svn://svn.cc65.org/cc65/trunk@4566 b7a2c559-68d2-44c3-8de9-860c34a00d81 --- diff --git a/libsrc/c64/c64-vdc.s b/libsrc/c64/c64-vdc.s index 5f3d9d9a7..be1626b1e 100644 --- a/libsrc/c64/c64-vdc.s +++ b/libsrc/c64/c64-vdc.s @@ -3,6 +3,10 @@ ; (based on code by Ullrich von Bassewitz) ; Maciej 'YTM/Elysium' Witkowiak ; 06,20.12.2002 +; +; VDC test added by +; Marco van den Heuvel, 2010-01-22 +; .include "zeropage.inc" @@ -67,35 +71,49 @@ window: .res 256 ; memory window ; INSTALL: - ; do test for VDC presence here??? - - ldx #VDC_CSET ; determine size of RAM... - jsr vdcgetreg - sta tmp1 - ora #%00010000 - jsr vdcputreg ; turn on 64k - - jsr settestadr1 ; save original value of test byte - jsr vdcgetbyte - sta tmp2 - - lda #$55 ; write $55 here - ldy #ptr1 - jsr test64k ; read it here and there - lda #$aa ; write $aa here - ldy #ptr2 - jsr test64k ; read it here and there + ldx #0 + ldy #0 + lda #VDC_CSET ; determine size of RAM... + sta VDC_ADDR_REG + +@L0: bit VDC_ADDR_REG + bmi @present + inx + bne @L0 + iny + bne @L0 + lda #EM_ERR_NO_DEVICE + rts - jsr settestadr1 - lda tmp2 - jsr vdcputbyte ; restore original value of test byte - - lda ptr1 ; do bytes match? - cmp ptr1+1 - bne @have64k - lda ptr2 - cmp ptr2+1 - bne @have64k +@present: + ldx #VDC_CSET ; determine size of RAM... + jsr vdcgetreg + sta tmp1 + ora #%00010000 + jsr vdcputreg ; turn on 64k + + jsr settestadr1 ; save original value of test byte + jsr vdcgetbyte + sta tmp2 + + lda #$55 ; write $55 here + ldy #ptr1 + jsr test64k ; read it here and there + lda #$aa ; write $aa here + ldy #ptr2 + jsr test64k ; read it here and there + + jsr settestadr1 + lda tmp2 + jsr vdcputbyte ; restore original value of test byte + + lda ptr1 ; do bytes match? + cmp ptr1+1 + bne @have64k + lda ptr2 + cmp ptr2+1 + bne @have64k ldx #VDC_CSET lda tmp1