X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;ds=sidebyside;f=libsrc%2Fc64%2Fc64-vdc.s;h=be1626b1eb649c18cb3674f3af374f6e1a0df409;hb=6860ac7dfda72169a918e6508c3ecd6fd02e5934;hp=86e3ad91c51a695df07fc73a4b1c001fa5fd377e;hpb=2a293bfc6b34fc7a0dbc145e34bd643a25b09085;p=cc65 diff --git a/libsrc/c64/c64-vdc.s b/libsrc/c64/c64-vdc.s index 86e3ad91c..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" @@ -21,7 +25,7 @@ ; Driver signature .byte $65, $6d, $64 ; "emd" - .byte $00 ; EM API version number + .byte EMD_API_VERSION ; EM API version number ; Jump table. @@ -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 - - jsr settestadr1 - lda tmp2 - jsr vdcputbyte ; restore original value of test byte + 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 - 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 @@ -265,7 +283,7 @@ COPYFROM: ; Copy the remainder of the page -@L2: ldy #EM_COPY_COUNT +@L2: ldy #EM_COPY::COUNT lda (ptr3),y ; Get bytes in last page beq @L4 sta tmp1 @@ -301,7 +319,7 @@ COPYTO: ; Copy the remainder of the page -@L2: ldy #EM_COPY_COUNT +@L2: ldy #EM_COPY::COUNT lda (ptr3),y ; Get bytes in last page beq @L4 sta tmp1 @@ -360,21 +378,21 @@ setup: sta ptr3 stx ptr3+1 ; Save the passed em_copy pointer - ldy #EM_COPY_OFFS + ldy #EM_COPY::OFFS lda (ptr3),y sta ptr1 - ldy #EM_COPY_PAGE + ldy #EM_COPY::PAGE lda (ptr3),y sta ptr1+1 ; From - ldy #EM_COPY_BUF + ldy #EM_COPY::BUF lda (ptr3),y sta ptr2 iny lda (ptr3),y sta ptr2+1 ; To - ldy #EM_COPY_COUNT+1 + ldy #EM_COPY::COUNT+1 lda (ptr3),y ; Get number of pages sta tmp1 rts