1
0
mirror of https://github.com/cc65/cc65.git synced 2025-01-11 11:30:13 +00:00

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
This commit is contained in:
uz 2010-02-01 07:15:41 +00:00
parent 80b1dddb7f
commit 3bf4afae50

View File

@ -3,6 +3,10 @@
; (based on code by Ullrich von Bassewitz)
; Maciej 'YTM/Elysium' Witkowiak <ytm@elysium.pl>
; 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 #0
ldy #0
lda #VDC_CSET ; determine size of RAM...
sta VDC_ADDR_REG
ldx #VDC_CSET ; determine size of RAM...
jsr vdcgetreg
sta tmp1
ora #%00010000
jsr vdcputreg ; turn on 64k
@L0: bit VDC_ADDR_REG
bmi @present
inx
bne @L0
iny
bne @L0
lda #<EM_ERR_NO_DEVICE
ldx #>EM_ERR_NO_DEVICE
rts
jsr settestadr1 ; save original value of test byte
jsr vdcgetbyte
sta tmp2
@present:
ldx #VDC_CSET ; determine size of RAM...
jsr vdcgetreg
sta tmp1
ora #%00010000
jsr vdcputreg ; turn on 64k
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 ; save original value of test byte
jsr vdcgetbyte
sta tmp2
jsr settestadr1
lda tmp2
jsr vdcputbyte ; restore original value of test byte
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
lda ptr1 ; do bytes match?
cmp ptr1+1
bne @have64k
lda ptr2
cmp ptr2+1
bne @have64k
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