A2osX/SYS/KM.NSC.S.txt

314 lines
5.0 KiB
Plaintext
Raw Normal View History

2015-03-13 15:40:32 +00:00
NEW
2020-08-31 15:29:32 +00:00
AUTO 3,1
2015-03-13 15:40:32 +00:00
.LIST OFF
.OP 65C02
.OR $2000
2020-08-31 15:29:32 +00:00
.TF sys/km.nsc
2015-03-13 15:40:32 +00:00
*--------------------------------------
2020-07-23 10:18:11 +00:00
.INB inc/macros.i
.INB inc/io.i
.INB inc/monitor.i
.INB inc/mli.i
2015-03-13 15:40:32 +00:00
*--------------------------------------
TmpPtr1 .EQ $0
TmpPtr2 .EQ $2
2018-08-24 10:20:23 +00:00
offset .EQ $4
2015-03-13 15:40:32 +00:00
*--------------------------------------
2018-07-12 15:20:39 +00:00
NSC.Init >LDYAI NSC.MSG0
2015-03-13 15:40:32 +00:00
jsr NSC.Print
lda MACHID
and #MACHID.CLK Clock already installed ?
beq .1
2021-05-30 20:34:03 +00:00
2018-07-12 15:20:39 +00:00
>LDYAI NSC.MSG1
2021-05-31 10:10:53 +00:00
bra NSC.Print
2015-03-13 15:40:32 +00:00
.1 jsr NSC.Detect
bcc .2
2018-07-12 15:20:39 +00:00
>LDYAI NSC.MSG2
2021-05-31 10:10:53 +00:00
bra NSC.Print
2015-03-13 15:40:32 +00:00
.2 jsr NSC.Install
2021-05-31 10:10:53 +00:00
lda #MACHID.CLK
tsb MACHID
2015-03-13 15:40:32 +00:00
2018-07-12 15:20:39 +00:00
>LDYAI NSC.MSG3
2021-05-31 10:10:53 +00:00
* jmp NSC.Print
*--------------------------------------
NSC.Print sty TmpPtr1
sta TmpPtr1+1
ldy #0
.1 lda (TmpPtr1),y
beq .8
jsr COUT
iny
bne .1
.8 jmp CROUT
2018-08-24 10:20:23 +00:00
*--------------------------------------
2019-10-03 06:25:27 +00:00
DS1216E.DATA1 .EQ $10
DS1216E.DATA2 .EQ $18
2015-03-13 15:40:32 +00:00
*--------------------------------------
2021-05-31 10:10:53 +00:00
NSC.Detect php
2015-03-13 15:40:32 +00:00
sei
2021-05-30 20:34:03 +00:00
2021-06-03 17:43:28 +00:00
lda RDCXROM
2021-05-31 10:10:53 +00:00
php
2021-06-03 17:43:28 +00:00
sta SETCXROM
2021-05-30 20:34:03 +00:00
2016-02-21 20:42:55 +00:00
sta $C300
2015-03-13 15:40:32 +00:00
2021-05-31 10:10:53 +00:00
ldx #8
2021-05-30 20:34:03 +00:00
2015-03-13 15:40:32 +00:00
.1 ldy #8
2021-05-30 20:34:03 +00:00
2015-03-13 15:40:32 +00:00
.2 lda $C304
lsr
2021-05-31 10:10:53 +00:00
ror DS1216E.DATA1-1,x
2015-03-13 15:40:32 +00:00
dey
bne .2
2021-05-30 20:34:03 +00:00
2015-03-13 15:40:32 +00:00
dex
2021-05-31 10:10:53 +00:00
bne .1
2021-05-30 20:34:03 +00:00
2021-05-31 10:10:53 +00:00
sta $C300
2015-03-13 15:40:32 +00:00
lda $C304 Reset DS1216E comparison register with READ A2=1
2021-05-30 20:34:03 +00:00
2021-05-31 10:10:53 +00:00
ldx #8 Read 8 bytes...
2021-05-30 20:34:03 +00:00
2021-05-31 10:10:53 +00:00
.3 ldy #8 ....of 8 bits
2021-05-30 20:34:03 +00:00
2021-05-31 10:10:53 +00:00
lda DS1216E.PATTERN-1,x
.4 lsr
bcs .5
2021-05-30 20:34:03 +00:00
2021-05-31 10:10:53 +00:00
bit $C300
bra .50
2021-05-30 20:34:03 +00:00
2021-05-31 10:10:53 +00:00
.5 bit $C301 Write Pattern bit in A0, with A2=0
2021-05-30 20:34:03 +00:00
2021-05-31 10:10:53 +00:00
.50 dey
2015-03-13 15:40:32 +00:00
bne .4
2021-05-30 20:34:03 +00:00
2021-05-31 10:10:53 +00:00
dex
bne .3
2021-05-30 20:34:03 +00:00
2021-05-31 10:10:53 +00:00
ldx #8
2021-05-30 20:34:03 +00:00
2015-03-13 15:40:32 +00:00
.6 ldy #8
2021-05-30 20:34:03 +00:00
2015-03-13 15:40:32 +00:00
.7 lda $C304
2021-05-30 20:34:03 +00:00
2015-03-13 15:40:32 +00:00
lsr
2021-05-31 10:10:53 +00:00
ror DS1216E.DATA2-1,x
2021-05-30 20:34:03 +00:00
2015-03-13 15:40:32 +00:00
dey
bne .7
2021-05-30 20:34:03 +00:00
2015-03-13 15:40:32 +00:00
dex
2021-05-31 10:10:53 +00:00
bne .6
2021-05-30 20:34:03 +00:00
plp
2021-06-03 17:43:28 +00:00
bmi .8
2016-02-21 20:42:55 +00:00
2021-06-03 17:43:28 +00:00
sta CLRCXROM
2021-05-30 20:34:03 +00:00
2021-05-31 10:10:53 +00:00
.8 plp
2021-05-30 20:34:03 +00:00
2021-05-31 10:10:53 +00:00
ldx #8
.81 lda DS1216E.DATA1-1,x
cmp DS1216E.DATA2-1,x
2015-03-13 15:40:32 +00:00
bne .9
2021-05-30 20:34:03 +00:00
2015-03-13 15:40:32 +00:00
dex
2021-05-31 10:10:53 +00:00
bne .81
2021-05-30 20:34:03 +00:00
2015-03-13 15:40:32 +00:00
sec
rts
2021-05-30 20:34:03 +00:00
2016-02-21 20:42:55 +00:00
.9 clc
2015-03-13 15:40:32 +00:00
rts
*--------------------------------------
NSC.Install lda DATETIME+1
sta TmpPtr1
sec
sbc #NSCDRV.B.START
2018-08-24 10:20:23 +00:00
sta offset
2015-03-13 15:40:32 +00:00
lda DATETIME+2
sta TmpPtr1+1
sbc /NSCDRV.B.START
2018-08-24 10:20:23 +00:00
sta offset+1
2021-05-31 10:10:53 +00:00
2015-03-13 15:40:32 +00:00
ldy #1
ldx #0
.1 lda NSCDRV.RELOC,x
beq .2
2021-05-30 20:34:03 +00:00
2015-03-13 15:40:32 +00:00
sta TmpPtr2
inx
lda NSCDRV.RELOC,x
sta TmpPtr2+1
lda (TmpPtr2)
clc
2018-08-24 10:20:23 +00:00
adc offset
2015-03-13 15:40:32 +00:00
sta (TmpPtr2)
lda (TmpPtr2),y
2018-08-24 10:20:23 +00:00
adc offset+1
2015-03-13 15:40:32 +00:00
sta (TmpPtr2),y
inx
bne .1
2021-05-30 20:34:03 +00:00
2015-03-13 15:40:32 +00:00
.2 lda RRAMWRAMBNK1
lda RRAMWRAMBNK1
2018-08-24 10:20:23 +00:00
.3 ldy #NSCDRV.SIZE-1 always < 128
2015-03-13 15:40:32 +00:00
.7 lda NSCDRV.B.START,y
sta (TmpPtr1),y
2018-08-24 10:20:23 +00:00
dey
2021-05-30 20:34:03 +00:00
bpl .7
2015-03-13 15:40:32 +00:00
lda RROMBNK1
lda #$4C
sta DATETIME
rts
*--------------------------------------
NSCDRV.RELOC .DA NSCDRV.R1+1
2021-05-30 20:34:03 +00:00
* .DA NSCDRV.R2+1
* .DA NSCDRV.R3+1
2015-03-13 15:40:32 +00:00
.DA NSCDRV.R4+1
.DA NSCDRV.R5+1
.DA NSCDRV.R6+1
.DA NSCDRV.R7+1
.DA NSCDRV.R8+1
2021-05-30 20:34:03 +00:00
* .DA NSCDRV.R9+1
2018-08-24 10:20:23 +00:00
.DA #0
2015-03-13 15:40:32 +00:00
*--------------------------------------
2018-08-24 10:20:23 +00:00
NSC.MSG0 .AZ -"NSC 'No-Slot-Clock'/DS1216E Driver For A2osX"
NSC.MSG1 .AZ -"Clock Already Present!"
NSC.MSG2 .AZ -"No DS1216E Detected!"
NSC.MSG3 .AZ -"DS1216E Driver Successfully Installed."
2015-03-13 15:40:32 +00:00
*--------------------------------------
* Driver For DS1216E
2021-05-30 20:34:03 +00:00
DS1216E.DATA .EQ $200 Reverted YY MM DD Day HH mm SS CS
2015-03-13 15:40:32 +00:00
*--------------------------------------
NSCDRV.B.START .EQ *
NSCDRV php
sei
2021-05-30 20:34:03 +00:00
2021-06-03 17:43:28 +00:00
lda RDCXROM
2021-05-30 20:34:03 +00:00
php
2021-06-03 17:43:28 +00:00
sta SETCXROM
2021-05-30 20:34:03 +00:00
2016-02-21 20:42:55 +00:00
sta $C300
2015-03-13 15:40:32 +00:00
lda $C304 Reset DS1216E comparison register with READ A2=1
2017-02-22 07:31:16 +00:00
2021-05-30 20:34:03 +00:00
ldx #8 Read 8 bytes...
NSCDRV.1 ldy #8 ....of 8 bits
2021-05-31 10:10:53 +00:00
NSCDRV.R1 lda DS1216E.PATTERN-1,x
2021-05-30 20:34:03 +00:00
NSCDRV.2 lsr
bcs NSCDRV.21
2017-02-22 07:31:16 +00:00
2021-05-30 20:34:03 +00:00
NSCDRV.20 bit $C300
bra NSCDRV.22
NSCDRV.21 bit $C301 Write Pattern bit in A0, with A2=0
NSCDRV.22 dey
2015-03-13 15:40:32 +00:00
bne NSCDRV.2
2017-02-22 07:31:16 +00:00
2021-05-31 10:10:53 +00:00
dex
2021-05-30 20:34:03 +00:00
bne NSCDRV.1
2017-02-22 07:31:16 +00:00
2021-05-30 20:34:03 +00:00
ldx #8
2017-02-22 07:31:16 +00:00
2015-03-13 15:40:32 +00:00
NSCDRV.4 ldy #8
2021-05-30 20:34:03 +00:00
NSCDRV.5 pha
lda $C304 Read Byte...
2017-02-22 07:31:16 +00:00
2015-03-13 15:40:32 +00:00
lsr
2021-05-31 10:10:53 +00:00
pla
2021-05-30 20:34:03 +00:00
ror
2017-02-22 07:31:16 +00:00
2015-03-13 15:40:32 +00:00
dey
bne NSCDRV.5
2017-02-22 07:31:16 +00:00
2015-03-13 15:40:32 +00:00
pha
lsr
lsr
lsr
lsr
tay
pla
and #$0F
clc
.HS 2C Bit Absolute to skip adc #$0A
NSCDRV.6 adc #$0A
dey
2021-05-30 20:34:03 +00:00
bpl NSCDRV.6
2015-03-13 15:40:32 +00:00
2021-05-30 20:34:03 +00:00
NSCDRV.R4 sta DS1216E.DATA-1,x
2015-03-13 15:40:32 +00:00
dex
2021-05-30 20:34:03 +00:00
bne NSCDRV.4
2021-05-31 10:10:53 +00:00
pha DS1216E.DATA
2021-05-30 20:34:03 +00:00
2015-03-13 15:40:32 +00:00
NSCDRV.R7 lda DS1216E.DATA+1 Get MM
asl
2017-02-22 07:31:16 +00:00
asl
2015-03-13 15:40:32 +00:00
asl
asl
asl
NSCDRV.R8 ora DS1216E.DATA+2 Get DD
sta DATELO
2021-05-30 20:34:03 +00:00
2021-05-31 10:10:53 +00:00
*NSCDRV.R9 lda DS1216E.DATA Get YY
2021-05-30 20:34:03 +00:00
pla
rol
sta DATELO+1
NSCDRV.R6 lda DS1216E.DATA+5 Get mm
sta TIMELO
2017-02-22 07:31:16 +00:00
2021-05-31 10:10:53 +00:00
NSCDRV.R5 lda DS1216E.DATA+4 Get HH
sta TIMELO+1
plp
2021-06-03 17:43:28 +00:00
bmi .8
2021-05-30 20:34:03 +00:00
2021-06-03 17:43:28 +00:00
sta CLRCXROM
2021-05-30 20:34:03 +00:00
.8 plp
2015-03-13 15:40:32 +00:00
rts
*--------------------------------------
DS1216E.PATTERN .HS 5CA33AC55CA33AC5 Reverted 7->0
*--------------------------------------
.LIST ON
NSCDRV.SIZE .EQ *-NSCDRV.B.START
.LIST OFF
2015-03-13 15:40:32 +00:00
*--------------------------------------
* CONTROL SECTION :
*--------------------------------------
.DO NSCDRV.SIZE>125
2021-05-30 20:34:03 +00:00
ERROR:NSCDRV.SIZE too big
2015-03-13 15:40:32 +00:00
.FIN
*--------------------------------------
MAN
2020-07-23 10:18:11 +00:00
SAVE usr/src/sys/km.nsc.s
2015-03-13 15:40:32 +00:00
ASM