From 361f14050e58954c5516dd63010ab5bae8613450 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9my=20GIBERT?= Date: Sun, 21 Feb 2016 21:42:55 +0100 Subject: [PATCH] Fix DS1216E properly detected in //c --- SYS/KM.NSC.S.txt | 59 ++++++++++++++++++++++++++++++------------------ 1 file changed, 37 insertions(+), 22 deletions(-) diff --git a/SYS/KM.NSC.S.txt b/SYS/KM.NSC.S.txt index 64198b22..fc991307 100644 --- a/SYS/KM.NSC.S.txt +++ b/SYS/KM.NSC.S.txt @@ -15,6 +15,7 @@ AUTO 6 *-------------------------------------- TmpPtr1 .EQ $0 TmpPtr2 .EQ $2 +DS1216E.DATA .EQ $200 *-------------------------------------- NSC.Init >LDAXI NSC.MSG0 jsr NSC.Print @@ -45,8 +46,10 @@ NSC.Init >LDAXI NSC.MSG0 *-------------------------------------- NSC.Detect php sei - sta $CFFF - sta $C00A + lda $CFFF + pha + + sta $C300 ldx #7 @@ -74,7 +77,9 @@ NSC.Detect php lsr bcc .5 iny -.5 sta $C300,y Write Pattern bit in A0, with A2=0 +.5 pha + lda $C300,y Write Pattern bit in A0, with A2=0 + pla dex bne .4 @@ -96,19 +101,22 @@ NSC.Detect php dex bpl .6 + pla + bmi .8 + sta $CFFF +.8 plp + ldx #7 -.8 lda DS1216E.DATA1,x +.81 lda DS1216E.DATA1,x cmp DS1216E.DATA2,x bne .9 dex - bpl .8 + bpl .81 - plp sec rts -.9 plp - clc +.9 clc rts *-------------------------------------- DS1216E.DATA1 .BS 8 @@ -166,6 +174,7 @@ NSC.Install lda DATETIME+1 *-------------------------------------- NSCDRV.OFFSET .BS 2 NSCDRV.RELOC .DA NSCDRV.R1+1 + .DA 0 .DA NSCDRV.R2+1 .DA NSCDRV.R3+1 .DA NSCDRV.R4+1 @@ -197,28 +206,31 @@ NSC.MSG3 >CSTRING "DS1216E Driver Successfully Installed." NSCDRV.B.START .EQ * NSCDRV php sei - sta $CFFF Make cards release $C8xx space - sta $C00A Force IIe/IIc Internal C300 rom + lda $CFFF Make cards release $C8xx space + pha + + sta $C300 lda $C304 Reset DS1216E comparison register with READ A2=1 - ldx #7 Read 8 bytes... + ldy #7 Read 8 bytes... NSCDRV.1 -NSCDRV.R1 lda DS1216E.PATTERN,x - phx - ldx #8 ....of 8 bits +NSCDRV.R1 lda DS1216E.PATTERN,y + phy + ldy #8 ....of 8 bits -NSCDRV.2 ldy #0 +NSCDRV.2 ldx #0 lsr bcc NSCDRV.21 - iny -NSCDRV.21 sta $C300,y Write Pattern bit in A0, with A2=0 - dex + inx + +NSCDRV.21 bit $C300,x Write Pattern bit in A0, with A2=0 + dey bne NSCDRV.2 - plx - dex + ply + dey bpl NSCDRV.1 ldx #7 @@ -273,11 +285,14 @@ NSCDRV.R9 lda DS1216E.DATA Get YY rol sta DATELO+1 - plp + pla + bmi .99 + sta $CFFF +.99 plp rts *-------------------------------------- DS1216E.PATTERN .HS 5CA33AC55CA33AC5 Reverted 7->0 -DS1216E.DATA .BS 8 Reverted YY MM DD Day HH mm SS CS +*DS1216E.DATA .BS 8 Reverted YY MM DD Day HH mm SS CS *-------------------------------------- NSCDRV.B.END .EQ * NSCDRV.SIZE .EQ NSCDRV.B.END-NSCDRV.B.START