ProDOS.FX:Added DCLK support and //c related Fixes

NSC: Reverted to $C3xx I/O space
This commit is contained in:
burniouf 2021-07-26 14:33:08 +02:00
parent 631571cc6e
commit 64b71db7b3
7 changed files with 290 additions and 76 deletions

Binary file not shown.

View File

@ -6,13 +6,22 @@ NEW
.OP 65C02
.OR $2000
.TF bin/nscutil
*--------------------------------------
NSC.IOBASE .EQ $C300
*--------------------------------------
.INB inc/macros.i
.INB inc/io.i
.INB inc/a2osx.i
.INB inc/mli.e.i
*--------------------------------------
ZPPtr1 .EQ ZPBIN
.DUMMY
.OR ZPBIN
ZS.START
DS121x.DATA0 .BS 8
DS121x.DATA1 .BS 8 Reverted YY MM DD Day HH mm SS CS
ZPPtr1 .BS 2
TmpByte .BS 1
ZS.END .ED
*--------------------------------------
* File Header (16 Bytes)
*--------------------------------------
@ -20,12 +29,12 @@ CS.START cld
jmp (.1,x)
.DA #$61 6502,Level 1 (65c02)
.DA #1 BIN Layout Version 1
.DA #0 S.PS.F.EVENT
.DA #0
.DA #0
.DA CS.END-CS.START CS
.DA DS.END-DS.START DS
.DA #16 SS
.DA #2 ZP
.DA CS.END-CS.START Code Size (without Constants)
.DA DS.END-DS.START Data Segment Size
.DA #16 Stack Size
.DA #ZS.END-ZS.START Zero Page Size
.DA 0
*--------------------------------------
* Relocation Table
@ -55,8 +64,8 @@ CS.RUN.READ jsr NSC.Init
jsr NSC.Read
ldx #7
.1 lda DS1216E.DETECT,x
eor DS1216E.DATA,x
.1 lda DS121x.DATA0,x
eor DS121x.DATA1,x
bne .8
dex
@ -86,11 +95,11 @@ CS.RUN.SET lda #1
bne .9
ldy #0
stz DS1216E.DATA+7
stz DS121x.DATA1+7
jsr GetBCD
bcs .9
sta DS1216E.DATA
sta DS121x.DATA1
lda (ZPPtr1),y
cmp #'/'
bne .9
@ -100,7 +109,7 @@ CS.RUN.SET lda #1
jsr GetBCD
bcs .9
sta DS1216E.DATA+1
sta DS121x.DATA1+1
lda (ZPPtr1),y
cmp #'/'
@ -111,7 +120,7 @@ CS.RUN.SET lda #1
jsr GetBCD
bcs .9
sta DS1216E.DATA+2
sta DS121x.DATA1+2
lda (ZPPtr1),y
cmp #','
@ -121,7 +130,7 @@ CS.RUN.SET lda #1
jsr GetBCD
bcs .9
sta DS1216E.DATA+4
sta DS121x.DATA1+4
lda (ZPPtr1),y
cmp #':'
@ -132,7 +141,7 @@ CS.RUN.SET lda #1
jsr GetBCD
bcs .9
sta DS1216E.DATA+5
sta DS121x.DATA1+5
lda (ZPPtr1),y
cmp #':'
@ -143,8 +152,8 @@ CS.RUN.SET lda #1
jsr GetBCD
bcs .9
sta DS1216E.DATA+6
stz DS1216E.DATA+7
sta DS121x.DATA1+6
stz DS121x.DATA1+7
jsr NSC.Write
lda #0 tell TSKMGR that all done ok, but
@ -173,9 +182,9 @@ NSC.Init php
.1 ldy #8
.2 lda $C104
.2 lda NSC.IOBASE+4
lsr
ror DS1216E.DETECT-1,x
ror DS121x.DATA0-1,x
dey
bne .2
@ -204,9 +213,9 @@ NSC.Read php
.1 ldy #8
.2 lda $C104
.2 lda NSC.IOBASE+4
lsr
ror DS1216E.DATA-1,x
ror DS121x.DATA1-1,x
dey
bne .2
@ -233,7 +242,7 @@ NSC.Write php
ldx #8 Write 8 bytes...
.3 lda DS1216E.DATA-1,x
.3 lda DS121x.DATA1-1,x
phx
ldx #8 ....of 8 bits
@ -245,7 +254,7 @@ NSC.Write php
iny
.5 pha
lda $C100,y Write Pattern bit in A0, with A2=0
lda NSC.IOBASE,y Write Pattern bit in A0, with A2=0
pla
dex
bne .4
@ -262,15 +271,14 @@ NSC.Write php
.8 plp
rts
*--------------------------------------
NSC.Select
sta $C100
NSC.Select sta NSC.IOBASE
* lda $C00B Workaround for Ultrawarp bug
lda $C104 Reset DS1216E comparison register with READ A2=1
lda NSC.IOBASE+4 Reset DS1216E comparison register with READ A2=1
ldy #8 Read 8 bytes...
.3 lda DS1216E.PATTERN-1,y
.3 lda DS121x.SIG-1,y
phy
ldy #8 ....of 8 bits
@ -281,7 +289,7 @@ NSC.Select
inx
.5 bit $C100,x Write Pattern bit in A0, with A2=0
.5 bit NSC.IOBASE,x Write Pattern bit in A0, with A2=0
dey
bne .4
@ -295,7 +303,7 @@ NSC.Select
NSC.Dump >PUSHW L.MSG.READ.OK1
ldx #1
ldy #1
lda DS1216E.DATA+3
lda DS121x.DATA1+3
bit #%00010000
beq .1
@ -314,7 +322,7 @@ NSC.Dump >PUSHW L.MSG.READ.OK1
>SYSCALL PrintF
>LDYA L.MSG.READ.OK2.24
bit DS1216E.DATA+4
bit DS121x.DATA1+4
bpl .3
>LDYA L.MSG.READ.OK2.12
@ -325,25 +333,25 @@ NSC.Dump >PUSHW L.MSG.READ.OK1
>PUSHBI 0
>SYSCALL PrintF
lda DS1216E.DATA
lda DS121x.DATA1
jsr PrintBCD
lda #'/'
>SYSCALL PutChar
lda DS1216E.DATA+1
lda DS121x.DATA1+1
jsr PrintBCD
lda #'/'
>SYSCALL PutChar
lda DS1216E.DATA+2
lda DS121x.DATA1+2
jsr PrintBCD
lda #','
>SYSCALL PutChar
lda DS1216E.DATA+4
lda DS121x.DATA1+4
bpl .4
and #$1F
@ -353,18 +361,18 @@ NSC.Dump >PUSHW L.MSG.READ.OK1
lda #':'
>SYSCALL PutChar
lda DS1216E.DATA+5
lda DS121x.DATA1+5
jsr PrintBCD
lda #':'
>SYSCALL PutChar
lda DS1216E.DATA+6
lda DS121x.DATA1+6
jsr PrintBCD
lda #'.'
>SYSCALL PutChar
lda DS1216E.DATA+7
lda DS121x.DATA1+7
jsr PrintBCD
>PUSHW L.MSG.CRLF
@ -424,10 +432,7 @@ MSG.READ.OK2.24 .AZ "24h"
MSG.READ.OK3 .AZ "\r\nCurrent Date/Time : "
MSG.USAGE .AS "\r\nTo Reset the chip and set clock, type:\r\nNSCUTIL YY/MM/DD,hh:mm:ss"
MSG.CRLF .AZ "\r\n"
DS1216E.PATTERN .HS 5CA33AC55CA33AC5 Reverted 7->0
DS1216E.DETECT .BS 8
DS1216E.DATA .BS 8 Reverted YY MM DD Day HH mm SS CS
TmpByte .BS 1
DS121x.SIG .HS 5CA33AC55CA33AC5 Reverted 7->0
*--------------------------------------
DS.START
DS.END

118
ProDOS.FX/ProDOS.S.DCLK.txt Normal file
View File

@ -0,0 +1,118 @@
NEW
AUTO 3,1
*--------------------------------------
* Driver For DS1215
*--------------------------------------
* we can safely use $200 (used by TCLK)
*--------------------------------------
DS1215.DATA .EQ $200 Reverted YY MM DD Day HH mm SS CS
*--------------------------------------
DCLK.START php
sei
lda $C400
stz $C0C0
ldy #8
stz $C0C2
lda $C0C3
pha
.1 lda DS1215.SIG-1,y
ldx #8
.2 sta $C0C3
stz $C0C0
lsr
dex
bne .2
dey
bne .1
ldx #8
.4 ldy #8
.5 pha
lda $C0C3
lsr
pla
ror
dey
bne .5
pha
lsr
lsr
lsr
lsr
tay
pla
and #$0F
clc
.HS 2C Bit Absolute to skip adc #$0A
.6 adc #$0A
dey
bpl .6
sta DS1215.DATA-1,x
dex
bne .4
pha DS1215.DATA
lda DS1215.DATA+1 Get MM
asl
asl
asl
asl
asl
ora DS1215.DATA+2 Get DD
sta DATELO
* lda DS1215.DATA Get YY
pla
rol
sta DATELO+1
lda DS1215.DATA+5 Get mm
sta TIMELO
lda DS1215.DATA+4 Get HH
sta TIMELO+1
stz $C0C0
pla
sta $C0C3
plp
rts
*--------------------------------------
DS1215.SIG .HS 5CA33AC55CA33AC5 Reverted 7->0
*--------------------------------------
.LIST ON
DCLK.LEN .EQ *-DCLK.START
.LIST OFF
*--------------------------------------
* CONTROL SECTION :
*--------------------------------------
.DO DCLK.LEN>125
ERROR:NCLK Driver too big
.FIN
*--------------------------------------
MAN
SAVE usr/src/prodos.fx/prodos.s.dclk
LOAD usr/src/prodos.fx/prodos.s
ASM

View File

@ -351,10 +351,84 @@ LDR.LCBNK1 lda RRAMWRAMBNK1 switch in LC bank 1
lda RRAMWRAMBNK1
rts
*--------------------------------------
DS1216E.DATA1 .EQ idxl
DS1216E.DATA2 .EQ A1L
DS121x.DATA1 .EQ idxl
DS121x.DATA2 .EQ A1L
*--------------------------------------
LDR.ClkDevScan php
LDR.ClkDevScan jsr LDR.IsIIc
bcc LDR.ClkDevNCLK
php
sei
lda $CFFF
lda $C400
ldy #8
stz $C0C0
stz $C0C1
sty $C0C2
lda $C0C3
pha
.1 lda DS121x.SIG-1,y
ldx #8
.2 sta $C0C3
stz $C0C0
lsr
dex
bne .2
dey
bne .1
ldx #8
.4 ldy #8
.5 lda $C0C3
lsr
ror DS121x.DATA1-1,x
dey
bne .5
dex
bne .4
pla
sta $C0C3
plp
sed
ldx #DS121x.ValidHI-DS121x.ValidLO
.6 lda DS121x.DATA1-1,x
cmp DS121x.ValidLO-1,x
bcc LDR.ClkDevNCLK
cmp DS121x.ValidHI-1,x
bcc .7
bne LDR.ClkDevNCLK
.7 dex
bne .6
cld
lda #'D'
ldx PAKME.DCLK
ldy PAKME.DCLK+1
jmp LDR.SetupCLK
*--------------------------------------
LDR.ClkDevNCLK cld
php
sei
lda RDCXROM
@ -362,30 +436,30 @@ LDR.ClkDevScan php
sta SETCXROM
* sta $C100
lda $C00B Workaround for Ultrawarp bug
sta NSC.IOBASE
* lda $C00B Workaround for Ultrawarp bug
ldx #8
.1 ldy #8
.2 lda $C104
.2 lda NSC.IOBASE+4
lsr
ror DS1216E.DATA1-1,x
ror DS121x.DATA1-1,x
dey
bne .2
dex
bne .1
*--------------------------------------
sta $C100
sta NSC.IOBASE
* lda $C00B Workaround for Ultrawarp bug
lda $C104 Reset DS1216E comparison register with READ A2=1
lda NSC.IOBASE+4 Reset DS1216E comparison register with READ A2=1
ldy #8 Read 8 bytes...
.3 lda DS1216E.SIG-1,y
.3 lda DS121x.SIG-1,y
phy
ldy #8 ....of 8 bits
@ -396,7 +470,7 @@ LDR.ClkDevScan php
inx
.5 bit $C100,x Write Pattern bit in A0, with A2=0
.5 bit NSC.IOBASE,x Write Pattern bit in A0, with A2=0
dey
bne .4
@ -409,9 +483,9 @@ LDR.ClkDevScan php
.6 ldy #8
.7 lda $C104
.7 lda NSC.IOBASE+4
lsr
ror DS1216E.DATA2-1,x
ror DS121x.DATA2-1,x
dey
bne .7
@ -427,8 +501,8 @@ LDR.ClkDevScan php
*--------------------------------------
ldx #8
.9 lda DS1216E.DATA1-1,x
cmp DS1216E.DATA2-1,x
.9 lda DS121x.DATA1-1,x
cmp DS121x.DATA2-1,x
bne .90
dex
@ -441,7 +515,10 @@ LDR.ClkDevScan php
ldy PAKME.NCLK+1
bra LDR.SetupCLK
*--------------------------------------
LDR.ClkDevTCLK stz idxl
LDR.ClkDevTCLK jsr LDR.IsIIc
bcs .9
stz idxl
lda #$C1
sta idxl+1
@ -488,14 +565,13 @@ LDR.ClkDevTCLK stz idxl
cmp #$C8
bne .1
rts
.9 rts
*--------------------------------------
LDR.SetupCLK stx ZPInBufPtr
sty ZPInBufPtr+1
sta LDR.MSG.CLK
bit RROMBNK2
ldx #LDR.MSG.CLK
jsr LDR.PrintX
@ -1072,6 +1148,7 @@ LDR.Scr80Init lda #$8C Reset 80 col screen ($0C:HOME)
ldx #LDR.MSG.PRODOS
*--------------------------------------
LDR.PrintX bit RROMBNK2
lda INVFLG
pha
jsr SETINV
@ -1180,7 +1257,9 @@ L2C4D lda 1,s
sec
rtl
*--------------------------------------
DS1216E.SIG .HS 5CA33AC55CA33AC5 Reverted 7->0
DS121x.SIG .HS 5CA33AC55CA33AC5 Reverted 7->0
DS121x.ValidLO .HS 00010101 Y,M,D,DoW
DS121x.ValidHI .HS 990C1F07
*--------------------------------------
* id bytes: evens for clock, odds for disk
dskid .HS 08.20.28.00.58.03.70

View File

@ -15,14 +15,14 @@ NCLK.START php
sta SETCXROM
sta $C100
sta NSC.IOBASE
* lda $C00B Workaround for Ultrawarp bug
lda $C104 Reset DS1216E comparison register with READ A2=1
lda NSC.IOBASE+4 Reset DS1216E comparison register with READ A2=1
ldy #8 Read 8 bytes...
.1 lda DS1216E.PATTERN-1,y
.1 lda DS1216E.SIG-1,y
phy
ldy #8 ....of 8 bits
@ -33,7 +33,7 @@ NCLK.START php
inx
.3 bit $C100,x Write Pattern bit in A0, with A2=0
.3 bit NSC.IOBASE,x Write Pattern bit in A0, with A2=0
dey
bne .2
@ -47,7 +47,7 @@ NCLK.START php
.4 ldy #8
.5 pha
lda $C104 Read Byte...
lda NSC.IOBASE+4 Read Byte...
lsr
pla
@ -108,7 +108,7 @@ NCLK.START php
.8 plp
rts
*--------------------------------------
DS1216E.PATTERN .HS 5CA33AC55CA33AC5 Reverted 7->0
DS1216E.SIG .HS 5CA33AC55CA33AC5 Reverted 7->0
*--------------------------------------
.LIST ON
NCLK.LEN .EQ *-NCLK.START

View File

@ -12,6 +12,8 @@ ACL .EQ 1
LOGO .EQ 1
*--------------------------------------
XRWDBG .EQ 0
*--------------------------------------
NSC.IOBASE .EQ $C300
*--------------------------------------
.INB inc/zp.i
.INB inc/io.i
@ -214,6 +216,7 @@ PAKME.XDOS .DA XDOS.PAK
PAKME.IRQ .DA IRQ.PAK
PAKME.RAM .DA RAM.PAK
PAKME.RAMX .DA RAMX.PAK
PAKME.DCLK .DA DCLK.PAK
PAKME.NCLK .DA NCLK.PAK
PAKME.TCLK .DA TCLK.PAK
PAKME.CCLK .DA CCLK.PAK
@ -267,6 +270,12 @@ RAMX.PAK .DA #0
.INB usr/src/prodos.fx/prodos.s.ramx
.EP
DCLK.PAK .DA #0
.DA DCLK.LEN
.PH XDOS.ClockDrv
.INB usr/src/prodos.fx/prodos.s.dclk
.EP
NCLK.PAK .DA #0
.DA NCLK.LEN
.PH XDOS.ClockDrv
@ -299,7 +308,7 @@ SEL2.PAK .DA #0
*--------------------------------------
.AS "PAKME" TAG
.DA $2000 BIN ORG
.DA #12 Chunk Count
.DA #13 Chunk Count
.DA PAKME.Table Chunks
*--------------------------------------
MAN

View File

@ -10,6 +10,8 @@ NEW
.INB inc/monitor.i
.INB inc/mli.i
*--------------------------------------
NSC.IOBASE .EQ $C300
*--------------------------------------
TmpPtr1 .EQ $0
TmpPtr2 .EQ $2
offset .EQ $4
@ -60,14 +62,14 @@ NSC.Detect php
sta SETCXROM
sta $C100
sta NSC.IOBASE
* lda $C00B Workaround for Ultrawarp bug
ldx #8
.1 ldy #8
.2 lda $C104
.2 lda NSC.IOBASE+4
lsr
ror DS1216E.DATA1-1,x
dey
@ -76,10 +78,10 @@ NSC.Detect php
dex
bne .1
sta $C100
sta NSC.IOBASE
* lda $C00B Workaround for Ultrawarp bug
lda $C104 Reset DS1216E comparison register with READ A2=1
lda NSC.IOBASE+4 Reset DS1216E comparison register with READ A2=1
ldy #8 Read 8 bytes...
@ -94,7 +96,7 @@ NSC.Detect php
inx
.5 bit $C100,x Write Pattern bit in A0, with A2=0
.5 bit NSC.IOBASE,x Write Pattern bit in A0, with A2=0
dey
bne .4
@ -107,7 +109,7 @@ NSC.Detect php
.6 ldy #8
.7 lda $C104
.7 lda NSC.IOBASE+4
lsr
ror DS1216E.DATA2-1,x
dey
@ -199,6 +201,7 @@ NSC.MSG2 .AZ -"No DS1216E Detected!"
NSC.MSG3 .AZ -"DS1216E Driver Successfully Installed."
*--------------------------------------
* Driver For DS1216E
*--------------------------------------
DS1216E.DATA .EQ $200 Reverted YY MM DD Day HH mm SS CS
*--------------------------------------
NSCDRV.B.START .EQ *
@ -210,10 +213,10 @@ NSCDRV php
sta SETCXROM
sta $C100
sta NSC.IOBASE
* lda $C00B Workaround for Ultrawarp bug
lda $C104 Reset DS1216E comparison register with READ A2=1
lda NSC.IOBASE+4 Reset DS1216E comparison register with READ A2=1
ldy #8 Read 8 bytes...
@ -228,7 +231,7 @@ NSCDRV.2 ldx #0
inx
NSCDRV.3 bit $C100,x Write Pattern bit in A0, with A2=0
NSCDRV.3 bit NSC.IOBASE,x Write Pattern bit in A0, with A2=0
dey
bne NSCDRV.2
@ -242,7 +245,7 @@ NSCDRV.3 bit $C100,x Write Pattern bit in A0, with A2=0
NSCDRV.4 ldy #8
NSCDRV.5 pha
lda $C104 Read Byte...
lda NSC.IOBASE+4 Read Byte...
lsr
pla