2020-01-21 07:34:32 +00:00
|
|
|
|
NEW
|
|
|
|
|
AUTO 3,1
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
* https://www.cise.ufl.edu/~cop4600/cgi-bin/lxr/http/source.cgi/lib/ansi/gmtime.c
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
SECSDAY .EQ 86400 60*60*24
|
2020-01-21 11:06:59 +00:00
|
|
|
|
CENT0 .EQ 19
|
2020-01-21 07:34:32 +00:00
|
|
|
|
YEAR0 .EQ 70
|
|
|
|
|
DAY0 .EQ 4 day 0 was a thursday
|
|
|
|
|
*--------------------------------------
|
2020-01-21 11:06:59 +00:00
|
|
|
|
* ZPPtr3 *S.TIME
|
|
|
|
|
* FORPNT str
|
|
|
|
|
* TXTPTR format
|
|
|
|
|
*--------------------------------------
|
2020-02-03 22:06:28 +00:00
|
|
|
|
TIMEX.StrFTime
|
2021-05-04 17:31:21 +00:00
|
|
|
|
.1 jsr SHARED.TXTPTRgn
|
2020-01-21 07:34:32 +00:00
|
|
|
|
beq .8
|
2020-01-21 11:06:59 +00:00
|
|
|
|
|
2020-01-21 07:34:32 +00:00
|
|
|
|
cmp #'%'
|
|
|
|
|
beq .2
|
2020-01-21 11:06:59 +00:00
|
|
|
|
|
2021-05-04 17:31:21 +00:00
|
|
|
|
jsr SHARED.FORPNTpn
|
2020-01-21 07:34:32 +00:00
|
|
|
|
bra .1
|
2020-01-21 11:06:59 +00:00
|
|
|
|
|
2020-01-21 07:34:32 +00:00
|
|
|
|
.2 ldx #K.StrFTime.Cnt-1
|
2021-05-04 17:31:21 +00:00
|
|
|
|
jsr SHARED.TXTPTRgn
|
2020-01-21 07:34:32 +00:00
|
|
|
|
beq .8
|
2020-01-21 11:06:59 +00:00
|
|
|
|
|
2020-01-21 07:34:32 +00:00
|
|
|
|
.3 cmp K.StrFTime.Tbl,x
|
|
|
|
|
beq .4
|
|
|
|
|
dex
|
|
|
|
|
bpl .3
|
2020-01-21 11:06:59 +00:00
|
|
|
|
|
2020-01-21 07:34:32 +00:00
|
|
|
|
bra .1
|
2020-01-21 11:06:59 +00:00
|
|
|
|
|
2020-01-21 07:34:32 +00:00
|
|
|
|
.4 cpx #7
|
|
|
|
|
bcc .5
|
|
|
|
|
jsr K.StrFTime.AtX
|
|
|
|
|
bra .1
|
|
|
|
|
|
|
|
|
|
.5 txa
|
|
|
|
|
asl
|
|
|
|
|
tax
|
|
|
|
|
jsr .7
|
|
|
|
|
bra .1
|
|
|
|
|
|
|
|
|
|
.7 jmp (K.StrFTime.JMP,x)
|
|
|
|
|
|
|
|
|
|
.8 lda #0 Terminate C string
|
2021-05-04 17:31:21 +00:00
|
|
|
|
jsr SHARED.FORPNTpn
|
2020-01-21 07:34:32 +00:00
|
|
|
|
clc
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
K.StrFTime.Tbl .AS "aAbBIpYydHSwmM"
|
|
|
|
|
K.StrFTime.Cnt .EQ *-K.StrFTime.TBL
|
|
|
|
|
K.StrFTime.OfsX .DA #S.Time.YEAR,#S.Time.DAY,#S.Time.HOUR,#S.Time.SECOND,#S.Time.WDAY,#S.Time.MONTH,#S.Time.MINUTE
|
|
|
|
|
K.StrFTime.JMP .DA K.StrFTime.A
|
|
|
|
|
.DA K.StrFTime.AA
|
|
|
|
|
.DA K.StrFTime.B
|
|
|
|
|
.DA K.StrFTime.BB
|
|
|
|
|
.DA K.StrFTime.II
|
|
|
|
|
.DA K.StrFTime.P
|
|
|
|
|
.DA K.StrFTime.YY
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
K.StrFTime.A sec Short day of week, 3 chars...
|
|
|
|
|
.HS 90 BCC
|
|
|
|
|
|
|
|
|
|
K.StrFTime.AA clc full DoW
|
2020-01-21 11:06:59 +00:00
|
|
|
|
lda #TIMEX.DAY
|
|
|
|
|
ldx /TIMEX.DAY
|
2020-01-21 07:34:32 +00:00
|
|
|
|
ldy #S.Time.WDAY
|
|
|
|
|
bra K.StrFTime.STR
|
|
|
|
|
K.StrFTime.B sec Short Month, 3 chars....
|
|
|
|
|
.HS 90 BCC
|
|
|
|
|
K.StrFTime.BB clc full Month....
|
2020-01-21 11:06:59 +00:00
|
|
|
|
lda #TIMEX.MON
|
|
|
|
|
ldx /TIMEX.MON
|
2020-01-21 07:34:32 +00:00
|
|
|
|
ldy #S.Time.MONTH
|
|
|
|
|
K.StrFTime.STR sta ZPPtr4
|
|
|
|
|
stx ZPPtr4+1
|
|
|
|
|
|
|
|
|
|
ldx #15
|
|
|
|
|
bcc .10
|
|
|
|
|
ldx #3
|
2020-01-21 11:06:59 +00:00
|
|
|
|
|
2021-05-04 17:31:21 +00:00
|
|
|
|
.10 jsr SHARED.P3gY get required S.Time field value
|
2020-01-21 07:34:32 +00:00
|
|
|
|
|
|
|
|
|
tay
|
|
|
|
|
beq .2 Illegal value, print ???
|
|
|
|
|
.1 lda (ZPPtr4)
|
|
|
|
|
sec
|
|
|
|
|
adc ZPPtr4
|
|
|
|
|
sta ZPPtr4
|
|
|
|
|
bcc .11
|
|
|
|
|
inc ZPPtr4+1
|
|
|
|
|
.11 dey
|
|
|
|
|
bne .1
|
|
|
|
|
.2
|
|
|
|
|
* ldy #0 Y is already 0
|
|
|
|
|
|
|
|
|
|
.3 iny
|
|
|
|
|
lda (ZPPtr4),y
|
2021-05-04 17:31:21 +00:00
|
|
|
|
jsr SHARED.FORPNTpn
|
2020-01-21 07:34:32 +00:00
|
|
|
|
tya
|
|
|
|
|
cmp (ZPPtr4)
|
|
|
|
|
beq .8
|
|
|
|
|
dex
|
|
|
|
|
bne .3
|
|
|
|
|
|
|
|
|
|
.8 rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
K.StrFTime.II ldy #S.Time.HOUR
|
2021-05-04 17:31:21 +00:00
|
|
|
|
jsr SHARED.P3gY
|
2020-01-21 07:34:32 +00:00
|
|
|
|
cmp #12
|
|
|
|
|
bcc K.StrFTime.addDecA
|
|
|
|
|
sbc #12
|
|
|
|
|
bra K.StrFTime.addDecA
|
2020-01-21 11:06:59 +00:00
|
|
|
|
|
2020-01-21 07:34:32 +00:00
|
|
|
|
K.StrFTime.P ldy #S.Time.HOUR
|
2021-05-04 17:31:21 +00:00
|
|
|
|
jsr SHARED.P3gY
|
2020-01-21 07:34:32 +00:00
|
|
|
|
cmp #12
|
|
|
|
|
bcc .1
|
|
|
|
|
lda #'p'
|
|
|
|
|
.HS 2C bit abs
|
|
|
|
|
.1 lda #'a'
|
2021-05-04 17:31:21 +00:00
|
|
|
|
jsr SHARED.FORPNTpn
|
2020-01-21 07:34:32 +00:00
|
|
|
|
lda #'m'
|
2021-05-04 17:31:21 +00:00
|
|
|
|
jmp SHARED.FORPNTpn
|
2020-01-21 11:06:59 +00:00
|
|
|
|
t
|
2020-01-21 07:34:32 +00:00
|
|
|
|
K.StrFTime.YY ldy #S.Time.CENTURY
|
2020-01-21 11:06:59 +00:00
|
|
|
|
jsr K.StrFTime.addDecPtr3Y
|
2020-01-21 07:34:32 +00:00
|
|
|
|
ldx #7 "y"
|
|
|
|
|
K.StrFTime.AtX ldy K.StrFTime.OfsX-7,x
|
|
|
|
|
*--------------------------------------
|
2020-01-21 11:06:59 +00:00
|
|
|
|
K.StrFTime.addDecPtr3Y
|
2021-05-04 17:31:21 +00:00
|
|
|
|
jsr SHARED.P3gY
|
2020-01-21 07:34:32 +00:00
|
|
|
|
K.StrFTime.addDecA
|
|
|
|
|
ldx #2
|
|
|
|
|
ldy #'0'
|
|
|
|
|
clc
|
2021-04-29 11:56:34 +00:00
|
|
|
|
jsr MATH.A2STR10
|
2021-05-04 17:31:21 +00:00
|
|
|
|
lda FOUTBuf
|
|
|
|
|
jsr SHARED.FORPNTpn
|
|
|
|
|
lda FOUTBuf+1
|
|
|
|
|
jmp SHARED.FORPNTpn
|
2020-01-21 07:34:32 +00:00
|
|
|
|
*--------------------------------------
|
2022-09-17 11:35:52 +00:00
|
|
|
|
TIMEX.DAY .PS "???"
|
|
|
|
|
.PS "Monday"
|
|
|
|
|
.PS "Tuesday"
|
|
|
|
|
.PS "Wednesday"
|
|
|
|
|
.PS "Thursday"
|
|
|
|
|
.PS "Friday"
|
|
|
|
|
.PS "Saturday"
|
|
|
|
|
.PS "Sunday"
|
2020-01-21 07:34:32 +00:00
|
|
|
|
*--------------------------------------
|
2022-09-17 11:35:52 +00:00
|
|
|
|
TIMEX.MON .PS "???"
|
|
|
|
|
.PS "January"
|
|
|
|
|
.PS "February"
|
|
|
|
|
.PS "March"
|
|
|
|
|
.PS "April"
|
|
|
|
|
.PS "May"
|
|
|
|
|
.PS "June"
|
|
|
|
|
.PS "July"
|
|
|
|
|
.PS "August"
|
|
|
|
|
.PS "September"
|
|
|
|
|
.PS "October"
|
|
|
|
|
.PS "November"
|
|
|
|
|
.PS "December"
|
2020-01-21 07:34:32 +00:00
|
|
|
|
*--------------------------------------
|
2020-08-04 07:10:48 +00:00
|
|
|
|
TIMEX.PTime2Time.BAD
|
2020-10-31 10:33:29 +00:00
|
|
|
|
lda #E.OOB
|
2020-08-04 07:10:48 +00:00
|
|
|
|
sec
|
|
|
|
|
rts
|
2020-02-03 22:06:28 +00:00
|
|
|
|
TIMEX.PTime2Time
|
2020-08-04 07:10:48 +00:00
|
|
|
|
ldy #3
|
2021-05-04 17:31:21 +00:00
|
|
|
|
jsr SHARED.TXTPTRgY
|
2020-08-04 07:10:48 +00:00
|
|
|
|
and #%11100000
|
|
|
|
|
bne TIMEX.PTime2Time.BAD
|
|
|
|
|
|
|
|
|
|
dey
|
2021-05-04 17:31:21 +00:00
|
|
|
|
jsr SHARED.TXTPTRgY
|
2020-08-04 07:10:48 +00:00
|
|
|
|
and #%11000000
|
|
|
|
|
bne TIMEX.PTime2Time.BAD
|
|
|
|
|
|
|
|
|
|
dey ldy #1
|
|
|
|
|
|
2021-05-04 17:31:21 +00:00
|
|
|
|
jsr SHARED.TXTPTRgY Get Year
|
2020-01-21 07:34:32 +00:00
|
|
|
|
lsr C is high bit of month
|
|
|
|
|
ldy #S.Time.YEAR
|
2021-05-04 17:31:21 +00:00
|
|
|
|
jsr SHARED.FORPNTpY set year
|
2020-01-21 07:34:32 +00:00
|
|
|
|
sta ARG32+3 for computing Century/WDAY later
|
|
|
|
|
|
2020-01-21 11:06:59 +00:00
|
|
|
|
ldy #0
|
2021-05-04 17:31:21 +00:00
|
|
|
|
jsr SHARED.TXTPTRgY Get Month/day
|
2020-01-21 07:34:32 +00:00
|
|
|
|
|
2020-10-31 10:33:29 +00:00
|
|
|
|
tax save Day
|
|
|
|
|
ror C is high bit of month
|
2020-01-21 07:34:32 +00:00
|
|
|
|
lsr
|
|
|
|
|
lsr
|
|
|
|
|
lsr
|
|
|
|
|
lsr
|
2020-10-31 10:33:29 +00:00
|
|
|
|
beq TIMEX.PTime2Time.BAD
|
|
|
|
|
|
|
|
|
|
cmp #13
|
|
|
|
|
bcs TIMEX.PTime2Time.BAD
|
|
|
|
|
|
2020-01-21 07:34:32 +00:00
|
|
|
|
ldy #S.Time.MONTH
|
2021-05-04 17:31:21 +00:00
|
|
|
|
jsr SHARED.FORPNTpY set month
|
2020-01-21 11:06:59 +00:00
|
|
|
|
sta K.ComputeWDAY.1+1
|
|
|
|
|
|
2020-10-31 10:33:29 +00:00
|
|
|
|
txa get back day
|
|
|
|
|
beq TIMEX.PTime2Time.BAD
|
|
|
|
|
|
2020-01-21 07:34:32 +00:00
|
|
|
|
and #$1F
|
2020-10-31 10:33:29 +00:00
|
|
|
|
cmp #32
|
|
|
|
|
bcs TIMEX.PTime2Time.BAD
|
|
|
|
|
|
2020-01-21 07:34:32 +00:00
|
|
|
|
iny
|
2021-05-04 17:31:21 +00:00
|
|
|
|
jsr SHARED.FORPNTpY set day
|
2020-01-21 11:06:59 +00:00
|
|
|
|
|
|
|
|
|
dec adjust range 0.30 for MOD 7
|
|
|
|
|
sta ARG32.Sign For later...
|
2020-01-21 07:34:32 +00:00
|
|
|
|
|
|
|
|
|
lda ARG32+3 get back year
|
2020-10-31 10:33:29 +00:00
|
|
|
|
cmp #100
|
|
|
|
|
bcs TIMEX.PTime2Time.BAD
|
|
|
|
|
|
2020-01-21 07:34:32 +00:00
|
|
|
|
cmp #69 if before 70 CC,if > 70, CS
|
|
|
|
|
lda #0
|
|
|
|
|
rol get back C in bit 0
|
|
|
|
|
eor #1 toggle C
|
|
|
|
|
adc #19 set date before 1970 -> 20xx
|
2020-01-21 11:06:59 +00:00
|
|
|
|
ldy #0
|
2021-05-04 17:31:21 +00:00
|
|
|
|
jsr SHARED.FORPNTpY set Century
|
2020-01-21 07:34:32 +00:00
|
|
|
|
sta ARG32+2 for computing WDAY later
|
|
|
|
|
|
|
|
|
|
ldy #2
|
2021-05-04 17:31:21 +00:00
|
|
|
|
jsr SHARED.TXTPTRgY Get Min
|
2020-01-21 07:34:32 +00:00
|
|
|
|
tax
|
|
|
|
|
iny
|
2021-05-04 17:31:21 +00:00
|
|
|
|
jsr SHARED.TXTPTRgY Get Hour
|
2020-01-21 07:34:32 +00:00
|
|
|
|
ldy #S.Time.HOUR
|
2021-05-04 17:31:21 +00:00
|
|
|
|
jsr SHARED.FORPNTpY set hour
|
2020-01-21 07:34:32 +00:00
|
|
|
|
iny
|
|
|
|
|
txa
|
2021-05-04 17:31:21 +00:00
|
|
|
|
jsr SHARED.FORPNTpY set min
|
2020-01-21 07:34:32 +00:00
|
|
|
|
iny
|
|
|
|
|
lda #0
|
2021-05-04 17:31:21 +00:00
|
|
|
|
jsr SHARED.FORPNTpY set seconds (ProDOS does not provide it)
|
2020-01-21 07:34:32 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
* 1/1/1970 was Thursday...if not leap, add one, if leap add 2
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
K.ComputeWDAY lda #DAY0-1 Thursday : 4 (-1 for mod 7)
|
|
|
|
|
pha
|
|
|
|
|
|
2020-10-31 10:33:29 +00:00
|
|
|
|
lda #CENT0 Starts at 1970
|
2020-01-21 07:34:32 +00:00
|
|
|
|
sta ARG32
|
|
|
|
|
lda #YEAR0
|
|
|
|
|
sta ARG32+1
|
|
|
|
|
|
|
|
|
|
.1 ldy ARG32
|
|
|
|
|
lda ARG32+1
|
|
|
|
|
|
|
|
|
|
cpy ARG32+2
|
|
|
|
|
bne .2
|
2020-10-31 10:33:29 +00:00
|
|
|
|
|
2020-01-21 07:34:32 +00:00
|
|
|
|
cmp ARG32+3
|
2020-01-21 11:06:59 +00:00
|
|
|
|
beq K.ComputeWDAY.1
|
2020-01-21 07:34:32 +00:00
|
|
|
|
|
|
|
|
|
.2 jsr TIMEX.IsLeap CS = Leap
|
|
|
|
|
|
|
|
|
|
pla
|
|
|
|
|
adc #1 365 mod 7
|
|
|
|
|
cmp #7
|
|
|
|
|
bcc .3
|
|
|
|
|
sbc #7 MOD 7
|
|
|
|
|
|
|
|
|
|
.3 pha
|
|
|
|
|
inc ARG32+1
|
|
|
|
|
lda ARG32+1
|
|
|
|
|
cmp #100
|
|
|
|
|
bne .1
|
|
|
|
|
|
|
|
|
|
stz ARG32+1
|
|
|
|
|
inc ARG32
|
|
|
|
|
bra .1
|
|
|
|
|
*--------------------------------------
|
2020-01-21 11:06:59 +00:00
|
|
|
|
K.ComputeWDAY.1 ldx #$ff SELF MODIFIED : month
|
2020-01-21 07:34:32 +00:00
|
|
|
|
|
|
|
|
|
dex don't include actual month
|
|
|
|
|
beq .71
|
|
|
|
|
|
|
|
|
|
.5 clc assume NO leap
|
|
|
|
|
|
2020-01-21 11:06:59 +00:00
|
|
|
|
lda TIMEX.MDAY-1,x get day count in this month
|
2020-01-21 07:34:32 +00:00
|
|
|
|
bne .6 february ?
|
|
|
|
|
|
|
|
|
|
ldy ARG32+2
|
|
|
|
|
lda ARG32+3
|
|
|
|
|
jsr TIMEX.IsLeap CS = Leap
|
|
|
|
|
|
|
|
|
|
.6 pla
|
2020-01-21 11:06:59 +00:00
|
|
|
|
adc TIMEX.MDAY-1,x
|
2020-01-21 07:34:32 +00:00
|
|
|
|
|
|
|
|
|
cmp #7
|
|
|
|
|
bcc .7
|
|
|
|
|
sbc #7
|
|
|
|
|
|
|
|
|
|
.7 pha
|
|
|
|
|
dex
|
|
|
|
|
bne .5
|
|
|
|
|
|
|
|
|
|
.71 pla
|
|
|
|
|
clc
|
2020-01-21 11:06:59 +00:00
|
|
|
|
|
|
|
|
|
adc ARG32.Sign get day in month (0..30)
|
2020-01-21 07:34:32 +00:00
|
|
|
|
|
|
|
|
|
.8 cmp #7 MOD 7
|
|
|
|
|
bcc .80
|
|
|
|
|
sbc #7
|
|
|
|
|
bra .8
|
|
|
|
|
|
|
|
|
|
.80 inc adjust range 1..7
|
|
|
|
|
ldy #S.Time.WDAY
|
2020-10-31 10:33:29 +00:00
|
|
|
|
|
|
|
|
|
* clc
|
2021-05-04 17:31:21 +00:00
|
|
|
|
jmp SHARED.FORPNTpY
|
2020-01-21 07:34:32 +00:00
|
|
|
|
*--------------------------------------
|
2020-12-23 14:54:57 +00:00
|
|
|
|
* TXTPTR ctime
|
|
|
|
|
* FORPNT S.TIME
|
2020-01-21 11:06:59 +00:00
|
|
|
|
*--------------------------------------
|
2020-02-03 22:06:28 +00:00
|
|
|
|
TIMEX.CTime2Time
|
|
|
|
|
ldy #3
|
2020-01-21 07:34:32 +00:00
|
|
|
|
|
2021-05-04 17:31:21 +00:00
|
|
|
|
.1 jsr SHARED.TXTPTRgY
|
2020-01-21 07:34:32 +00:00
|
|
|
|
sta ARG32,y ARG = ctime
|
|
|
|
|
dey
|
|
|
|
|
bpl .1
|
|
|
|
|
|
|
|
|
|
lda #SECSDAY ACC = SECSDAY
|
|
|
|
|
sta ACC32
|
|
|
|
|
lda /SECSDAY
|
|
|
|
|
sta ACC32+1
|
|
|
|
|
lda ^SECSDAY
|
|
|
|
|
sta ACC32+2
|
|
|
|
|
stz ACC32+3
|
2021-04-29 11:56:34 +00:00
|
|
|
|
jsr M32.DIVMOD ARG32 = Days, TMP32 = remaining secs
|
2020-01-21 07:34:32 +00:00
|
|
|
|
|
|
|
|
|
lda ARG32 WDAY computation : (ARG32 + DAY0) mod 7
|
|
|
|
|
clc
|
|
|
|
|
adc #DAY0
|
|
|
|
|
pha
|
|
|
|
|
lda ARG32+1 65535 days = 179 years
|
|
|
|
|
adc /DAY0
|
|
|
|
|
eor #$ff
|
|
|
|
|
tax
|
|
|
|
|
pla
|
2020-10-31 10:33:29 +00:00
|
|
|
|
|
2020-01-21 07:34:32 +00:00
|
|
|
|
.2 tay
|
|
|
|
|
sec
|
|
|
|
|
sbc #7
|
|
|
|
|
bcs .2
|
2020-10-31 10:33:29 +00:00
|
|
|
|
|
2020-01-21 07:34:32 +00:00
|
|
|
|
inx
|
|
|
|
|
bne .2
|
2020-10-31 10:33:29 +00:00
|
|
|
|
|
2020-01-21 07:34:32 +00:00
|
|
|
|
tya
|
|
|
|
|
ldy #S.Time.WDAY
|
2021-05-04 17:31:21 +00:00
|
|
|
|
jsr SHARED.FORPNTpY
|
2020-12-23 14:54:57 +00:00
|
|
|
|
|
2020-01-21 11:06:59 +00:00
|
|
|
|
ldy #CENT0
|
2020-01-21 07:34:32 +00:00
|
|
|
|
sty ZPPtr3
|
|
|
|
|
lda #YEAR0
|
|
|
|
|
sta ZPPtr3+1
|
2020-12-23 14:54:57 +00:00
|
|
|
|
K.CTime2Time.Y
|
2020-01-21 07:34:32 +00:00
|
|
|
|
.1 ldy ZPPtr3
|
|
|
|
|
lda ZPPtr3+1
|
|
|
|
|
jsr TIMEX.IsLeap if Leap year CS
|
|
|
|
|
rol Toggle Carry
|
|
|
|
|
eor #1
|
|
|
|
|
lsr
|
|
|
|
|
lda ARG32
|
|
|
|
|
sbc #365
|
|
|
|
|
pha
|
|
|
|
|
lda ARG32+1
|
|
|
|
|
sbc /365
|
|
|
|
|
bcc .2
|
2020-10-31 10:33:29 +00:00
|
|
|
|
|
2020-01-21 07:34:32 +00:00
|
|
|
|
sta ARG32+1
|
|
|
|
|
pla
|
|
|
|
|
sta ARG32
|
2020-12-23 14:54:57 +00:00
|
|
|
|
inc ZPPtr3+1
|
|
|
|
|
lda ZPPtr3+1
|
2020-01-21 07:34:32 +00:00
|
|
|
|
cmp #100
|
|
|
|
|
bne .1
|
|
|
|
|
|
2020-12-23 14:54:57 +00:00
|
|
|
|
stz ZPPtr3+1
|
|
|
|
|
inc ZPPtr3
|
|
|
|
|
bra .1
|
2020-10-31 10:33:29 +00:00
|
|
|
|
|
2020-01-21 07:34:32 +00:00
|
|
|
|
.2 pla
|
|
|
|
|
|
2020-12-23 14:54:57 +00:00
|
|
|
|
lda ZPPtr3
|
|
|
|
|
ldy #S.Time.CENTURY
|
2021-05-04 17:31:21 +00:00
|
|
|
|
jsr SHARED.FORPNTpY
|
2020-01-21 07:34:32 +00:00
|
|
|
|
|
|
|
|
|
ldy #S.Time.YEAR
|
2020-12-23 14:54:57 +00:00
|
|
|
|
lda ZPPtr3+1
|
2021-05-04 17:31:21 +00:00
|
|
|
|
jsr SHARED.FORPNTpY
|
2020-12-23 14:54:57 +00:00
|
|
|
|
K.CTime2Time.MD
|
|
|
|
|
ldx #1 X = January
|
|
|
|
|
|
|
|
|
|
.1 clc
|
|
|
|
|
txa
|
|
|
|
|
eor #2
|
|
|
|
|
|
|
|
|
|
bne .2
|
|
|
|
|
|
|
|
|
|
>LDYA ZPPtr3 Current Year
|
|
|
|
|
jsr TIMEX.IsLeap
|
|
|
|
|
|
|
|
|
|
.2 lda TIMEX.MDAY-1,x
|
|
|
|
|
adc #28 A = days of X
|
|
|
|
|
|
|
|
|
|
sta .3+1
|
|
|
|
|
|
|
|
|
|
lda ARG32 ARG32/ARG32+1 = 0 .. 364 or 365
|
|
|
|
|
sec
|
|
|
|
|
|
|
|
|
|
.3 sbc #$ff SELF MODIFIED
|
|
|
|
|
pha
|
|
|
|
|
lda ARG32+1
|
|
|
|
|
sbc #0
|
|
|
|
|
bcc .4
|
|
|
|
|
|
|
|
|
|
sta ARG32+1
|
|
|
|
|
pla
|
|
|
|
|
sta ARG32
|
|
|
|
|
inx
|
|
|
|
|
bra .1
|
|
|
|
|
|
|
|
|
|
.4 pla
|
|
|
|
|
ldy #S.TIME.MONTH
|
|
|
|
|
txa
|
2021-05-04 17:31:21 +00:00
|
|
|
|
jsr SHARED.FORPNTpY
|
2020-12-23 14:54:57 +00:00
|
|
|
|
|
|
|
|
|
iny S.TIME.DAY
|
|
|
|
|
|
|
|
|
|
lda ARG32
|
|
|
|
|
inc
|
2021-05-04 17:31:21 +00:00
|
|
|
|
jsr SHARED.FORPNTpY
|
2020-12-23 14:54:57 +00:00
|
|
|
|
|
2020-01-21 07:34:32 +00:00
|
|
|
|
K.CTime2Time.HMS
|
|
|
|
|
ldx #3
|
2020-12-23 14:54:57 +00:00
|
|
|
|
|
2020-01-21 07:34:32 +00:00
|
|
|
|
.1 lda TMP32,x
|
|
|
|
|
sta ARG32,x
|
|
|
|
|
dex
|
|
|
|
|
bpl .1
|
2020-12-23 14:54:57 +00:00
|
|
|
|
|
2020-01-21 07:34:32 +00:00
|
|
|
|
ldy #S.TIME.SECOND
|
|
|
|
|
jsr .2
|
2020-12-23 14:54:57 +00:00
|
|
|
|
|
2020-01-21 07:34:32 +00:00
|
|
|
|
dey #S.TIME.MINUTE
|
2020-12-23 14:54:57 +00:00
|
|
|
|
|
2020-01-21 07:34:32 +00:00
|
|
|
|
jsr .2
|
2020-12-23 14:54:57 +00:00
|
|
|
|
|
2020-01-21 07:34:32 +00:00
|
|
|
|
dey #S.TIME.HOUR
|
|
|
|
|
lda ARG32
|
2021-05-04 17:31:21 +00:00
|
|
|
|
jsr SHARED.FORPNTpY
|
2020-01-21 07:34:32 +00:00
|
|
|
|
|
|
|
|
|
clc
|
|
|
|
|
rts
|
2020-12-23 14:54:57 +00:00
|
|
|
|
|
2020-01-21 07:34:32 +00:00
|
|
|
|
.2 phy
|
|
|
|
|
|
|
|
|
|
lda #60
|
2021-04-29 11:56:34 +00:00
|
|
|
|
jsr M32.A2ACC32
|
|
|
|
|
jsr M32.DIVMOD
|
2020-01-21 07:34:32 +00:00
|
|
|
|
ply
|
|
|
|
|
lda TMP32
|
2021-05-04 17:31:21 +00:00
|
|
|
|
jsr SHARED.FORPNTpY
|
2020-01-21 07:34:32 +00:00
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
* In :
|
|
|
|
|
* Y = Century
|
|
|
|
|
* A = Year (0..99)
|
|
|
|
|
* if (year mod 400 = 0)
|
|
|
|
|
* or
|
|
|
|
|
* if not (year mod 100 = 0) and (year mod 4 = 0)
|
|
|
|
|
* Out :
|
|
|
|
|
* CS = Leap
|
|
|
|
|
* CC = Not Leap
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
TIMEX.IsLeap cmp #0 Year = 00 ?
|
|
|
|
|
bne .1 no
|
|
|
|
|
|
|
|
|
|
tya year = 00, get century in A
|
|
|
|
|
|
|
|
|
|
and #$3 Century mod 4 = 0 ?
|
|
|
|
|
beq .9 leap year (2000)
|
2020-10-31 10:33:29 +00:00
|
|
|
|
|
2020-01-21 07:34:32 +00:00
|
|
|
|
.8 clc not leap (1900)
|
|
|
|
|
rts
|
|
|
|
|
|
|
|
|
|
.1 and #$3 mod 4 = 0 ?
|
|
|
|
|
bne .8
|
|
|
|
|
|
|
|
|
|
.9 sec Leap
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
2020-12-23 14:54:57 +00:00
|
|
|
|
TIMEX.MDAY .DA #3,#0,#3,#2,#3,#2,#3,#3,#2,#3,#2,#3
|
|
|
|
|
*--------------------------------------
|
2020-01-21 07:34:32 +00:00
|
|
|
|
MAN
|
2020-12-15 13:23:22 +00:00
|
|
|
|
SAVE usr/src/sys/kernel.s.timex
|
|
|
|
|
LOAD usr/src/sys/kernel.s
|
2020-01-21 07:34:32 +00:00
|
|
|
|
ASM
|