Kernel 0.9.1 : Bugfix in VSDRIVE & StrFTime

This commit is contained in:
Rémy GIBERT 2017-11-06 17:25:40 +01:00
parent 704a72cee7
commit fe9635ccd5
6 changed files with 86 additions and 76 deletions

Binary file not shown.

Binary file not shown.

View File

@ -449,7 +449,7 @@ Cmd.Exec.TIME clc
>LEA.G CMD.Time
>SYSCALL Time.YA
>PUSHWI ZPCMDBuf
>PUSHW ZPCMDBuf
plp
bcc .1
>PUSHW L.FMT.DATE
@ -459,7 +459,7 @@ Cmd.Exec.TIME clc
.2 >PUSHEA.G CMD.Time
>SYSCALL StrFTime
>LDYAI ZPCMDBuf
>LDYA ZPCMDBuf
>SYSCALL PrintF.YA
bcs Cmd.Exec.ECHO.END
bra Cmd.Exec.ECHO.CR

View File

@ -567,7 +567,7 @@ MSG.ECHO >CSTR ">%s\r\n"
MSG.ERROR >CSTR "[$%h]:%S.\r\n"
MSG.PRINTENV >CSTR "%s=%s\r\n"
MSG.CSHERR >CSTR "^\r\nLine #%D:"
FMT.DATE >CSTR "%A, %B %d %Y"
FMT.DATE >CSTR "%A (%w), %B %d %Y"
FMT.TIME >CSTR "%H:%M:%S (%I:%M:%S%p)"
*--------------------------------------
.INB /A2OSX.SRC/X.ERRORS.S

View File

@ -33,13 +33,13 @@ K.Time.YA >STYA ZPPtr2
K.PTime2Time jsr PullP1P2
TIME.PTime2TimeP1P2
ldy #1
lda (ZPPtr1),y Get Year
lda (ZPPtr1),y Get Year
lsr C is high bit of month
ldy #S.Time.YEAR
sta (ZPPtr2),y set year
sta (ZPPtr2),y set year
sta K.CTime.Year for conputing Century/WDAY later
lda (ZPPtr1) Get Month/day
lda (ZPPtr1) Get Month/day
pha save Day
ror
lsr
@ -47,12 +47,12 @@ TIME.PTime2TimeP1P2
lsr
lsr
ldy #S.Time.MONTH
sta (ZPPtr2),y set month
sta (ZPPtr2),y set month
pla get back day
and #$1F
iny
sta (ZPPtr2),y set day
sta (ZPPtr2),y set day
lda K.CTime.Year get back year
@ -61,23 +61,23 @@ TIME.PTime2TimeP1P2
rol get back C in bit 0
eor #1 toggle C
adc #19 set date before 1970 -> 20xx
sta (ZPPtr2) set Century
sta (ZPPtr2) set Century
sta K.CTime.Century for conputing WDAY later
ldy #2
lda (ZPPtr1),y Get Min
lda (ZPPtr1),y Get Min
tax
iny
lda (ZPPtr1),y Get Hour
lda (ZPPtr1),y Get Hour
ldy #S.Time.HOUR
sta (ZPPtr2),y set hour
sta (ZPPtr2),y set hour
iny
txa
sta (ZPPtr2),y set min
sta (ZPPtr2),y set min
iny
lda #0
sta (ZPPtr2),y set seconds (ProDOS does not provide it)
sta (ZPPtr2),y set seconds (ProDOS does not provide it)
* 1/1/1970 was Thursday...if not leap, add one, if leap add 2
@ -96,11 +96,7 @@ K.ComputeWDAY lda #3 Thursday : 4 (-1 for mod 7)
cmp K.CTime.Year
beq .4
.2 jsr TIME.IsLeapYearYA CC = Leap
lda #0
rol
eor #1
lsr
.2 jsr TIME.IsLeapYearYA CS = Leap
pla
adc #1
@ -119,19 +115,15 @@ K.ComputeWDAY lda #3 Thursday : 4 (-1 for mod 7)
bra .1
.4 ldy #S.Time.MONTH
lda (ZPPtr2),y get month
lda (ZPPtr2),y get month
tax
.5 lda K.StrFTime.MDAY-1,x get day count in this month
bne .6 february ?
bne .6 february ?
ldy K.CTime.Century
lda K.CTime.Year
jsr TIME.IsLeapYearYA CC = Leap
lda #0
rol
eor #1
lsr
jsr TIME.IsLeapYearYA CS = Leap
.6 pla
adc K.StrFTime.MDAY-1,x
@ -146,8 +138,8 @@ K.ComputeWDAY lda #3 Thursday : 4 (-1 for mod 7)
pla
ldy #S.Time.DAY
adc (ZPPtr2),y get month (1..31)
dec adjust range 0.31 for MOD 7
adc (ZPPtr2),y get day in month (1..31)
dec adjust range 0.30 for MOD 7
.8 cmp #7 MOD 7
bcc .80
@ -311,7 +303,13 @@ K.CTime2Time jsr PullP1P2
K.CTime2Time.Year
.1 ldy K.CTime.Century
lda K.CTime.Year
jsr TIME.IsLeapYearYA if Leap year CC
jsr TIME.IsLeapYearYA if Leap year CS
lda #0 Toggle Carry
rol
eor #1
lsr
lda K.CTime.DivDay
sbc #365
pha
@ -349,8 +347,8 @@ K.CTime2Time.Year
* or
* if not (year mod 100 = 0) and (year mod 4 = 0)
* Out :
* CC = Leap
* CS = Not Leap
* CS = Leap
* CC = Not Leap
*--------------------------------------
TIME.IsLeapYearYA
cmp #0 Year = 00 ?
@ -360,13 +358,13 @@ TIME.IsLeapYearYA
and #$3 mod 4 = 0 ?
beq .9 leap year
.8 sec not leap
.8 clc not leap
rts
.1 and #$3 mod 4 = 0 ?
bne .8
.9 clc Leap
.9 sec Leap
rts
*--------------------------------------
K.StrFTime.MDAY .DA #3,#0,#3,#2,#3,#2,#3,#3,#2,#3,#2,#3
@ -504,17 +502,16 @@ K.StrFTime.STR lda (ZPPtr1),y get required S.Time field value
inc ZPPtr4+1
bra .1
.2 ldy #0
.2
* ldy #0 Y is already 0
.3 iny
lda (ZPPtr4),y
phy
jsr K.StrFTime.addChar
pla
tya
cmp (ZPPtr4)
beq .8
tay
dex
bne .3
.8 rts

View File

@ -40,11 +40,12 @@ VSDRIVE.Init >LDAXI VSDRIVE.MSG0
jsr PrintFAX
jsr VSDRIVE.Ping
bcs .92
>LDAXI VSDRIVE.SRVOK
jsr PrintFAX
jsr VSDRIVE.SetSlot
bcs .91
@ -52,7 +53,7 @@ VSDRIVE.Init >LDAXI VSDRIVE.MSG0
pha 2 times
>LDAXI VSDRIVE.DEVOK
jsr PrintFAX
jsr VSDRIVE.Install
>LDAXI VSDRIVE.OK
@ -148,63 +149,75 @@ VSDRIVE.Ping ldx DRV+2 DRV.Slotn0
bit #SSC.STATUS.TDRE Ready for transmit?
bne .2
inc VSDRIVE.Ping.TO Wait.......
bne .1
inc VSDRIVE.Ping.TO+1
jsr VSDRIVE.IncTimer Wait.......
bne .1
dey
bne .1
sec
rts
lda #1
.9 sec
rts Time Out.....
ldy #10 10 retries...
.2 lda #$C4 Send "D" (DIR)
sta SSC.DATA,x
ldy #4 Five bytes to send
stz VSDRIVE.Ping.TO
stz VSDRIVE.Ping.TO+1
.3 inc VSDRIVE.Ping.TO
bne .4
inc VSDRIVE.Ping.TO+1
.2 lda VSDRIVE.Ping.CMD,y
sta SSC.DATA,x
.3 lda SSC.STATUS,x
bit #SSC.STATUS.TDRE char transmitted?
bne .4
dey
bne .2
jsr VSDRIVE.IncTimer
bne .3
lda #2
bra .9
sec
rts Time Out.....
.4 lda SSC.STATUS,x
.4 dey
bpl .2 next byte
lda #518^$ff
sta VSDRIVE.Ping.BC
lda /518^$ff
sta VSDRIVE.Ping.BC+1
stz VSDRIVE.Ping.TO
stz VSDRIVE.Ping.TO+1
ldy #20
.5 lda SSC.STATUS,x
and #SSC.STATUS.RDRF incoming char?
bne .6
jsr VSDRIVE.IncTimer
bne .5
dey
bne .5
inc VSDRIVE.Ping.TO
bne .4
inc VSDRIVE.Ping.TO+1
bne .4
lda #3
bra .9
.5 lda SSC.DATA,x
bne .4 end of string ?
.6 lda SSC.STATUS,x
and #SSC.STATUS.RDRF incoming char?
bne .7
inc VSDRIVE.Ping.TO
bne .6
inc VSDRIVE.Ping.TO+1
bne .6
.6 lda SSC.DATA,x
.7 lda SSC.DATA,x
bne .4 end of list ?
inc VSDRIVE.Ping.BC 518 bytes to recieve
bne .5
inc VSDRIVE.Ping.BC+1
bne .5
clc
rts
VSDRIVE.Ping.TO .BS 2
*--------------------------------------
VSDRIVE.IncTimer
inc VSDRIVE.Ping.TO
bne .8
inc VSDRIVE.Ping.TO+1
.8 rts
*--------------------------------------
VSDRIVE.Ping.CMD .HS C4000001C5 C4=C5 eor 01 eor 00 eor 00
VSDRIVE.Ping.TO .BS 2
VSDRIVE.Ping.BC .BS 2
*--------------------------------------
* Find 2 free slots in DEVPTRS (D1 & D2)
*--------------------------------------