2017-12-22 21:24:30 +00:00
|
|
|
|
NEW
|
2019-05-25 19:24:07 +00:00
|
|
|
|
AUTO 3,1
|
2016-08-30 20:26:19 +00:00
|
|
|
|
*--------------------------------------
|
2016-08-31 15:38:48 +00:00
|
|
|
|
* https://www.cise.ufl.edu/~cop4600/cgi-bin/lxr/http/source.cgi/lib/ansi/gmtime.c
|
2016-08-30 20:26:19 +00:00
|
|
|
|
*--------------------------------------
|
2016-08-31 15:38:48 +00:00
|
|
|
|
SECSDAY .EQ 86400 60*60*24
|
|
|
|
|
CENTURY0 .EQ 19
|
|
|
|
|
YEAR0 .EQ 70
|
|
|
|
|
DAY0 .EQ 4 day 0 was a thursday
|
2017-09-22 15:25:21 +00:00
|
|
|
|
*/--------------------------------------
|
2018-06-18 06:22:50 +00:00
|
|
|
|
* # Time
|
|
|
|
|
* Get System Time in Buffer
|
2018-06-18 08:44:02 +00:00
|
|
|
|
* ## C
|
2018-09-05 15:22:46 +00:00
|
|
|
|
* `time_t time (S.TIME* timer);`
|
2018-10-04 15:30:14 +00:00
|
|
|
|
* ## ASM
|
2018-10-11 15:23:06 +00:00
|
|
|
|
* `>LDYA timer`
|
|
|
|
|
* `>SYSCALL time`
|
|
|
|
|
* ## RETURN VALUE
|
2018-06-18 06:22:50 +00:00
|
|
|
|
* S.TIME filled with System date/time
|
2017-09-22 15:25:21 +00:00
|
|
|
|
*\--------------------------------------
|
2019-06-28 15:15:58 +00:00
|
|
|
|
K.Time >PUSHYA
|
2016-09-05 16:00:11 +00:00
|
|
|
|
>MLICALL MLIGETTIME
|
|
|
|
|
>LDYAI DATELO
|
2017-09-22 15:25:21 +00:00
|
|
|
|
*/--------------------------------------
|
|
|
|
|
* # PTime2Time
|
|
|
|
|
* Convert ProDOS Time To S.TIME
|
2018-06-18 08:44:02 +00:00
|
|
|
|
* ## C
|
2018-09-05 15:22:46 +00:00
|
|
|
|
* `int PTime2Time (long* ptime, S.TIME* timer);`
|
2018-10-04 15:30:14 +00:00
|
|
|
|
* ## ASM
|
2018-09-05 15:22:46 +00:00
|
|
|
|
* `>PUSHW timer`
|
|
|
|
|
* `>LDYA ptime`
|
|
|
|
|
* `>SYSCALL PTime2Time`
|
2018-10-11 15:23:06 +00:00
|
|
|
|
* ## RETURN VALUE
|
2017-09-22 15:25:21 +00:00
|
|
|
|
*\--------------------------------------
|
2018-10-11 15:23:06 +00:00
|
|
|
|
K.PTime2Time jsr MEM.SPtr1PPtr2
|
2019-07-16 15:42:36 +00:00
|
|
|
|
|
2017-08-25 06:37:21 +00:00
|
|
|
|
ldy #1
|
2017-11-06 16:25:40 +00:00
|
|
|
|
lda (ZPPtr1),y Get Year
|
2016-09-05 16:00:11 +00:00
|
|
|
|
lsr C is high bit of month
|
2016-09-21 15:20:37 +00:00
|
|
|
|
ldy #S.Time.YEAR
|
2017-11-06 16:25:40 +00:00
|
|
|
|
sta (ZPPtr2),y set year
|
2019-07-26 14:23:07 +00:00
|
|
|
|
sta ACC32+3 for conputing Century/WDAY later
|
2016-09-05 16:00:11 +00:00
|
|
|
|
|
2017-11-06 16:25:40 +00:00
|
|
|
|
lda (ZPPtr1) Get Month/day
|
2016-09-05 16:00:11 +00:00
|
|
|
|
pha save Day
|
|
|
|
|
ror
|
|
|
|
|
lsr
|
|
|
|
|
lsr
|
|
|
|
|
lsr
|
|
|
|
|
lsr
|
2016-09-21 15:20:37 +00:00
|
|
|
|
ldy #S.Time.MONTH
|
2017-11-06 16:25:40 +00:00
|
|
|
|
sta (ZPPtr2),y set month
|
2016-09-05 16:00:11 +00:00
|
|
|
|
|
|
|
|
|
pla get back day
|
|
|
|
|
and #$1F
|
|
|
|
|
iny
|
2017-11-06 16:25:40 +00:00
|
|
|
|
sta (ZPPtr2),y set day
|
2016-09-05 16:00:11 +00:00
|
|
|
|
|
2019-07-26 14:23:07 +00:00
|
|
|
|
lda ACC32+3 get back year
|
2016-09-05 16:00:11 +00:00
|
|
|
|
|
2016-09-12 19:46:54 +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
|
2017-11-06 16:25:40 +00:00
|
|
|
|
sta (ZPPtr2) set Century
|
2019-07-26 14:23:07 +00:00
|
|
|
|
sta ACC32+2 for conputing WDAY later
|
2016-09-05 16:00:11 +00:00
|
|
|
|
|
2016-09-12 19:46:54 +00:00
|
|
|
|
ldy #2
|
2017-11-06 16:25:40 +00:00
|
|
|
|
lda (ZPPtr1),y Get Min
|
2016-09-05 16:00:11 +00:00
|
|
|
|
tax
|
2016-09-12 19:46:54 +00:00
|
|
|
|
iny
|
2017-11-06 16:25:40 +00:00
|
|
|
|
lda (ZPPtr1),y Get Hour
|
2016-09-05 16:00:11 +00:00
|
|
|
|
|
2016-09-21 15:20:37 +00:00
|
|
|
|
ldy #S.Time.HOUR
|
2017-11-06 16:25:40 +00:00
|
|
|
|
sta (ZPPtr2),y set hour
|
2016-09-05 16:00:11 +00:00
|
|
|
|
iny
|
|
|
|
|
txa
|
2017-11-06 16:25:40 +00:00
|
|
|
|
sta (ZPPtr2),y set min
|
2016-09-05 16:00:11 +00:00
|
|
|
|
iny
|
|
|
|
|
lda #0
|
2017-11-06 16:25:40 +00:00
|
|
|
|
sta (ZPPtr2),y set seconds (ProDOS does not provide it)
|
2019-07-26 14:23:07 +00:00
|
|
|
|
*--------------------------------------
|
2016-09-12 19:46:54 +00:00
|
|
|
|
* 1/1/1970 was Thursday...if not leap, add one, if leap add 2
|
2019-07-26 14:23:07 +00:00
|
|
|
|
*--------------------------------------
|
2019-07-03 15:25:07 +00:00
|
|
|
|
K.ComputeWDAY lda #DAY0-1 Thursday : 4 (-1 for mod 7)
|
2016-09-12 19:46:54 +00:00
|
|
|
|
pha
|
|
|
|
|
lda #19
|
2019-07-26 14:23:07 +00:00
|
|
|
|
sta ACC32
|
2016-09-12 19:46:54 +00:00
|
|
|
|
lda #70
|
2019-07-26 14:23:07 +00:00
|
|
|
|
sta ACC32+1
|
2016-09-12 19:46:54 +00:00
|
|
|
|
|
2019-07-26 14:23:07 +00:00
|
|
|
|
.1 ldy ACC32
|
|
|
|
|
lda ACC32+1
|
2016-09-12 19:46:54 +00:00
|
|
|
|
|
2019-07-26 14:23:07 +00:00
|
|
|
|
cpy ACC32+2
|
2016-09-12 19:46:54 +00:00
|
|
|
|
bne .2
|
2019-07-26 14:23:07 +00:00
|
|
|
|
cmp ACC32+3
|
2016-09-12 19:46:54 +00:00
|
|
|
|
beq .4
|
|
|
|
|
|
2017-11-06 16:25:40 +00:00
|
|
|
|
.2 jsr TIME.IsLeapYearYA CS = Leap
|
2016-09-12 19:46:54 +00:00
|
|
|
|
|
|
|
|
|
pla
|
|
|
|
|
adc #1
|
|
|
|
|
cmp #7
|
|
|
|
|
bcc .3
|
|
|
|
|
sbc #7 MOD 7
|
|
|
|
|
|
|
|
|
|
.3 pha
|
2019-07-26 14:23:07 +00:00
|
|
|
|
inc ACC32+1
|
|
|
|
|
lda ACC32+1
|
2016-09-12 19:46:54 +00:00
|
|
|
|
cmp #100
|
|
|
|
|
bne .1
|
2019-07-15 15:43:17 +00:00
|
|
|
|
|
2019-07-26 14:23:07 +00:00
|
|
|
|
stz ACC32+1
|
|
|
|
|
inc ACC32
|
2016-09-12 19:46:54 +00:00
|
|
|
|
bra .1
|
2019-07-26 14:23:07 +00:00
|
|
|
|
*--------------------------------------
|
2016-09-21 15:20:37 +00:00
|
|
|
|
.4 ldy #S.Time.MONTH
|
2017-11-06 16:25:40 +00:00
|
|
|
|
lda (ZPPtr2),y get month
|
2016-09-12 19:46:54 +00:00
|
|
|
|
tax
|
|
|
|
|
|
2016-09-21 15:20:37 +00:00
|
|
|
|
.5 lda K.StrFTime.MDAY-1,x get day count in this month
|
2019-07-26 14:23:07 +00:00
|
|
|
|
clc
|
2017-11-06 16:25:40 +00:00
|
|
|
|
bne .6 february ?
|
2016-09-12 19:46:54 +00:00
|
|
|
|
|
2019-07-26 14:23:07 +00:00
|
|
|
|
ldy ACC32+2
|
|
|
|
|
lda ACC32+3
|
2017-11-06 16:25:40 +00:00
|
|
|
|
jsr TIME.IsLeapYearYA CS = Leap
|
2016-09-12 19:46:54 +00:00
|
|
|
|
|
|
|
|
|
.6 pla
|
2016-09-21 15:20:37 +00:00
|
|
|
|
adc K.StrFTime.MDAY-1,x
|
2016-09-12 19:46:54 +00:00
|
|
|
|
cmp #7
|
|
|
|
|
bcc .7
|
|
|
|
|
sbc #7
|
|
|
|
|
|
|
|
|
|
.7 pha
|
|
|
|
|
dex
|
|
|
|
|
bne .5
|
|
|
|
|
|
|
|
|
|
pla
|
|
|
|
|
|
2016-09-21 15:20:37 +00:00
|
|
|
|
ldy #S.Time.DAY
|
2017-11-06 16:25:40 +00:00
|
|
|
|
adc (ZPPtr2),y get day in month (1..31)
|
|
|
|
|
dec adjust range 0.30 for MOD 7
|
2016-09-12 19:46:54 +00:00
|
|
|
|
|
|
|
|
|
.8 cmp #7 MOD 7
|
|
|
|
|
bcc .80
|
|
|
|
|
sbc #7
|
|
|
|
|
bra .8
|
|
|
|
|
|
|
|
|
|
.80 inc adjust range 1..7
|
2016-09-21 15:20:37 +00:00
|
|
|
|
ldy #S.Time.WDAY
|
2017-01-12 17:43:45 +00:00
|
|
|
|
sta (ZPPtr2),y
|
2016-09-12 19:46:54 +00:00
|
|
|
|
|
2016-09-05 16:00:11 +00:00
|
|
|
|
clc
|
|
|
|
|
rts
|
2017-09-22 15:25:21 +00:00
|
|
|
|
*/--------------------------------------
|
2017-10-09 15:30:48 +00:00
|
|
|
|
* # CTime2Time
|
2018-09-05 15:22:46 +00:00
|
|
|
|
* Convert CTime Time To S.TIME
|
|
|
|
|
* ## C
|
|
|
|
|
* `int CTime2Time (long* ctime, S.TIME* timer);`
|
2018-10-04 15:30:14 +00:00
|
|
|
|
* ## ASM
|
2018-09-05 15:22:46 +00:00
|
|
|
|
* `>PUSHW timer`
|
|
|
|
|
* `>LDYA ctime`
|
|
|
|
|
* `>SYSCALL CTime2Time`
|
2018-10-11 15:23:06 +00:00
|
|
|
|
* ## RETURN VALUE
|
2017-09-22 15:25:21 +00:00
|
|
|
|
*\--------------------------------------
|
2018-10-11 15:23:06 +00:00
|
|
|
|
K.CTime2Time jsr MEM.SPtr1PPtr2
|
2016-08-31 15:38:48 +00:00
|
|
|
|
|
|
|
|
|
ldy #3
|
|
|
|
|
|
2017-01-12 17:43:45 +00:00
|
|
|
|
.1 lda (ZPPtr1),y
|
2019-07-03 15:25:07 +00:00
|
|
|
|
sta ARG32,y ARG = ctime
|
2016-08-31 15:38:48 +00:00
|
|
|
|
dey
|
|
|
|
|
bpl .1
|
|
|
|
|
|
2019-07-03 15:25:07 +00:00
|
|
|
|
lda #SECSDAY ACC = SECSDAY
|
|
|
|
|
sta ACC32
|
2016-08-31 15:38:48 +00:00
|
|
|
|
|
2019-07-03 15:25:07 +00:00
|
|
|
|
lda /SECSDAY
|
|
|
|
|
sta ACC32+1
|
2017-07-01 13:44:40 +00:00
|
|
|
|
|
2019-07-03 15:25:07 +00:00
|
|
|
|
lda ^SECSDAY
|
|
|
|
|
sta ACC32+2
|
2016-08-31 15:38:48 +00:00
|
|
|
|
|
2019-07-03 15:25:07 +00:00
|
|
|
|
stz ACC32+3
|
2016-08-31 15:38:48 +00:00
|
|
|
|
|
2019-07-10 15:39:02 +00:00
|
|
|
|
jsr MATH.DIVMOD32 ARG32 = Days, TMP32 = remaining secs
|
2016-08-31 15:38:48 +00:00
|
|
|
|
|
2019-07-03 15:25:07 +00:00
|
|
|
|
lda ARG32 WDAY computation : (ARG32 + DAY0) mod 7
|
2016-08-30 20:26:19 +00:00
|
|
|
|
clc
|
2016-08-31 15:38:48 +00:00
|
|
|
|
adc #DAY0
|
|
|
|
|
pha
|
2019-07-03 15:25:07 +00:00
|
|
|
|
|
|
|
|
|
lda ARG32+1 65535 days = 179 years
|
2016-08-31 15:38:48 +00:00
|
|
|
|
adc /DAY0
|
|
|
|
|
eor #$ff
|
|
|
|
|
tax
|
2019-07-03 15:25:07 +00:00
|
|
|
|
|
2016-08-31 15:38:48 +00:00
|
|
|
|
pla
|
|
|
|
|
|
2019-07-03 15:25:07 +00:00
|
|
|
|
.2 tay
|
2016-08-31 15:38:48 +00:00
|
|
|
|
sec
|
|
|
|
|
sbc #7
|
2019-07-03 15:25:07 +00:00
|
|
|
|
bcs .2
|
2016-08-31 15:38:48 +00:00
|
|
|
|
inx
|
2019-07-03 15:25:07 +00:00
|
|
|
|
bne .2
|
2016-08-31 15:38:48 +00:00
|
|
|
|
|
2019-07-03 15:25:07 +00:00
|
|
|
|
tya
|
2016-09-21 15:20:37 +00:00
|
|
|
|
ldy #S.Time.WDAY
|
2017-01-12 17:43:45 +00:00
|
|
|
|
sta (ZPPtr2),y
|
2016-08-31 15:38:48 +00:00
|
|
|
|
|
2019-07-26 14:23:07 +00:00
|
|
|
|
ldy #CENTURY0
|
|
|
|
|
sty ZPPtr3
|
2016-08-31 15:38:48 +00:00
|
|
|
|
lda #YEAR0
|
2019-07-26 14:23:07 +00:00
|
|
|
|
sta ZPPtr3+1
|
2019-07-03 15:25:07 +00:00
|
|
|
|
K.CTime2Time.Year
|
2019-07-26 14:23:07 +00:00
|
|
|
|
.1 ldy ZPPtr3
|
|
|
|
|
lda ZPPtr3+1
|
2017-11-06 16:25:40 +00:00
|
|
|
|
jsr TIME.IsLeapYearYA if Leap year CS
|
|
|
|
|
|
2019-07-15 15:43:17 +00:00
|
|
|
|
rol Toggle Carry
|
2017-11-06 16:25:40 +00:00
|
|
|
|
eor #1
|
|
|
|
|
lsr
|
|
|
|
|
|
2019-07-03 15:25:07 +00:00
|
|
|
|
lda ARG32
|
2016-09-01 05:42:28 +00:00
|
|
|
|
sbc #365
|
|
|
|
|
pha
|
2019-07-03 15:25:07 +00:00
|
|
|
|
lda ARG32+1
|
2016-09-01 05:42:28 +00:00
|
|
|
|
sbc /365
|
2016-09-02 06:09:44 +00:00
|
|
|
|
bcc .2
|
2016-08-31 15:38:48 +00:00
|
|
|
|
|
2019-07-03 15:25:07 +00:00
|
|
|
|
sta ARG32+1
|
2016-09-01 05:42:28 +00:00
|
|
|
|
pla
|
2019-07-03 15:25:07 +00:00
|
|
|
|
sta ARG32
|
2016-09-01 05:42:28 +00:00
|
|
|
|
|
2019-07-26 14:23:07 +00:00
|
|
|
|
inc ZPPtr3
|
|
|
|
|
lda ZPPtr3
|
2016-09-01 05:42:28 +00:00
|
|
|
|
cmp #100
|
2016-09-02 06:09:44 +00:00
|
|
|
|
bne .1
|
2019-07-10 15:39:02 +00:00
|
|
|
|
|
2019-07-26 14:23:07 +00:00
|
|
|
|
stz ZPPtr3
|
|
|
|
|
inc ZPPtr3+1
|
2016-09-02 06:09:44 +00:00
|
|
|
|
bne .1
|
2016-09-01 05:42:28 +00:00
|
|
|
|
|
2016-09-02 06:09:44 +00:00
|
|
|
|
.2 pla
|
2019-07-03 15:25:07 +00:00
|
|
|
|
|
2019-07-26 14:23:07 +00:00
|
|
|
|
lda ZPPtr3+1
|
2016-09-21 15:20:37 +00:00
|
|
|
|
* ldy #S.Time.CENTURY
|
2017-01-12 17:43:45 +00:00
|
|
|
|
sta (ZPPtr2)
|
2019-07-03 15:25:07 +00:00
|
|
|
|
|
2016-09-21 15:20:37 +00:00
|
|
|
|
ldy #S.Time.YEAR
|
2019-07-26 14:23:07 +00:00
|
|
|
|
lda ZPPtr3
|
2017-01-12 17:43:45 +00:00
|
|
|
|
sta (ZPPtr2),y
|
2019-07-03 15:25:07 +00:00
|
|
|
|
K.CTime2Time.HMS
|
|
|
|
|
ldx #3
|
|
|
|
|
|
|
|
|
|
.1 lda TMP32,x
|
|
|
|
|
sta ARG32,x
|
|
|
|
|
dex
|
|
|
|
|
bpl .1
|
|
|
|
|
|
2019-07-10 15:39:02 +00:00
|
|
|
|
ldy #S.TIME.SECOND
|
|
|
|
|
jsr .2
|
2019-07-03 15:25:07 +00:00
|
|
|
|
|
2019-07-10 15:39:02 +00:00
|
|
|
|
dey #S.TIME.MINUTE
|
|
|
|
|
jsr .2
|
2019-07-03 15:25:07 +00:00
|
|
|
|
|
2019-07-10 15:39:02 +00:00
|
|
|
|
dey #S.TIME.HOUR
|
|
|
|
|
lda ARG32
|
2019-07-03 15:25:07 +00:00
|
|
|
|
sta (ZPPtr2),y
|
|
|
|
|
|
2019-07-10 15:39:02 +00:00
|
|
|
|
clc
|
|
|
|
|
rts
|
|
|
|
|
|
|
|
|
|
.2 phy
|
|
|
|
|
|
2019-07-03 15:25:07 +00:00
|
|
|
|
lda #60
|
2019-07-10 15:39:02 +00:00
|
|
|
|
jsr MATH.A2ACC32
|
2019-07-03 15:25:07 +00:00
|
|
|
|
|
2019-07-10 15:39:02 +00:00
|
|
|
|
jsr MATH.DIVMOD32
|
2016-09-01 05:42:28 +00:00
|
|
|
|
|
2019-07-10 15:39:02 +00:00
|
|
|
|
ply
|
2019-07-03 15:25:07 +00:00
|
|
|
|
lda TMP32
|
|
|
|
|
sta (ZPPtr2),y
|
2016-09-02 06:09:44 +00:00
|
|
|
|
rts
|
2016-09-01 05:42:28 +00:00
|
|
|
|
*--------------------------------------
|
2016-09-12 19:46:54 +00:00
|
|
|
|
* In :
|
|
|
|
|
* Y = Century
|
|
|
|
|
* A = Year (0..99)
|
2016-09-01 05:42:28 +00:00
|
|
|
|
* if (year mod 400 = 0)
|
|
|
|
|
* or
|
|
|
|
|
* if not (year mod 100 = 0) and (year mod 4 = 0)
|
2016-09-12 19:46:54 +00:00
|
|
|
|
* Out :
|
2017-11-06 16:25:40 +00:00
|
|
|
|
* CS = Leap
|
|
|
|
|
* CC = Not Leap
|
2016-08-31 15:38:48 +00:00
|
|
|
|
*--------------------------------------
|
2016-09-28 15:34:15 +00:00
|
|
|
|
TIME.IsLeapYearYA
|
|
|
|
|
cmp #0 Year = 00 ?
|
2016-09-01 05:42:28 +00:00
|
|
|
|
bne .1 no
|
|
|
|
|
|
|
|
|
|
tya year = 00, get century in a
|
|
|
|
|
and #$3 mod 4 = 0 ?
|
|
|
|
|
beq .9 leap year
|
|
|
|
|
|
2017-11-06 16:25:40 +00:00
|
|
|
|
.8 clc not leap
|
2016-09-01 05:42:28 +00:00
|
|
|
|
rts
|
2016-08-31 15:38:48 +00:00
|
|
|
|
|
2016-09-01 05:42:28 +00:00
|
|
|
|
.1 and #$3 mod 4 = 0 ?
|
|
|
|
|
bne .8
|
|
|
|
|
|
2017-11-06 16:25:40 +00:00
|
|
|
|
.9 sec Leap
|
2016-08-31 15:38:48 +00:00
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
2016-09-28 15:34:15 +00:00
|
|
|
|
K.StrFTime.MDAY .DA #3,#0,#3,#2,#3,#2,#3,#3,#2,#3,#2,#3
|
2017-08-24 06:47:31 +00:00
|
|
|
|
*/--------------------------------------
|
|
|
|
|
* # StrFTime
|
2018-06-18 06:22:50 +00:00
|
|
|
|
* ## C
|
2017-08-24 06:47:31 +00:00
|
|
|
|
* Convert S.TIME struct to CSTR
|
2019-01-04 13:17:31 +00:00
|
|
|
|
* `void strftime (char* ptr, const char* format, const struct S.TIME* timeptr );`
|
2018-06-18 06:22:50 +00:00
|
|
|
|
* ## ASM
|
2018-10-11 15:23:06 +00:00
|
|
|
|
* `PUSHW timeptr`
|
|
|
|
|
* `PUSHW format`
|
2018-06-18 08:44:02 +00:00
|
|
|
|
* + %a : Abbreviated weekday name : Thu
|
|
|
|
|
* + %A : Full weekday name : Thursday
|
|
|
|
|
* + %b : Abbreviated month name : Aug
|
|
|
|
|
* + %B : Full month name : August
|
|
|
|
|
* + %d : Day of the month, zero-padded (01-31)
|
|
|
|
|
* + %H : Hour in 24h format (00-23) 14
|
|
|
|
|
* + %I : Hour in 12h format (01-12) 02
|
|
|
|
|
* + %m : Month as a decimal number (01-12) 08
|
|
|
|
|
* + %M : Minute (00-59) 55
|
|
|
|
|
* + %p : AM or PM designation PM
|
|
|
|
|
* + %S : Second (00-61) 02
|
|
|
|
|
* + %w : Weekday as a decimal number with Sunday as 0 (0-6)
|
|
|
|
|
* + %y : Year, last two digits (00-99)
|
|
|
|
|
* + %Y : Year four digits 2001
|
2018-10-11 15:23:06 +00:00
|
|
|
|
* `>LDYA ptr`
|
|
|
|
|
* `>SYSCALL strftime`
|
|
|
|
|
* ## RETURN VALUE
|
2017-08-24 06:47:31 +00:00
|
|
|
|
* none. always succeed.
|
|
|
|
|
*\--------------------------------------
|
2018-10-11 15:23:06 +00:00
|
|
|
|
K.StrFTime jsr MEM.SPtr1PPtr2
|
|
|
|
|
>PULLW ZPPtr3 timeptr
|
2017-08-24 06:47:31 +00:00
|
|
|
|
|
2019-07-22 06:31:01 +00:00
|
|
|
|
.1 jsr MEM.GetCharPtr2
|
2017-08-24 06:47:31 +00:00
|
|
|
|
beq .8
|
|
|
|
|
|
|
|
|
|
cmp #'%'
|
|
|
|
|
beq .2
|
|
|
|
|
|
2019-06-24 15:32:22 +00:00
|
|
|
|
jsr MEM.PutCharPtr1
|
2017-08-24 06:47:31 +00:00
|
|
|
|
bra .1
|
|
|
|
|
|
2019-07-22 06:31:01 +00:00
|
|
|
|
.2 ldx #K.StrFTime.Cnt-1
|
2017-08-24 06:47:31 +00:00
|
|
|
|
|
2019-07-22 06:31:01 +00:00
|
|
|
|
jsr MEM.GetCharPtr2
|
2017-08-24 06:47:31 +00:00
|
|
|
|
beq .8
|
2019-01-04 13:17:31 +00:00
|
|
|
|
|
2017-08-24 06:47:31 +00:00
|
|
|
|
.3 cmp K.StrFTime.Tbl,x
|
|
|
|
|
beq .4
|
|
|
|
|
dex
|
|
|
|
|
bpl .3
|
|
|
|
|
bra .1
|
|
|
|
|
|
2019-07-22 06:31:01 +00:00
|
|
|
|
.4 cpx #7
|
|
|
|
|
bcc .5
|
|
|
|
|
jsr K.StrFTime.AtX
|
|
|
|
|
bra .1
|
|
|
|
|
|
|
|
|
|
.5 txa
|
2019-01-04 13:17:31 +00:00
|
|
|
|
asl
|
|
|
|
|
tax
|
2019-07-22 06:31:01 +00:00
|
|
|
|
jsr .7
|
2019-01-04 13:17:31 +00:00
|
|
|
|
bra .1
|
|
|
|
|
|
2019-07-22 06:31:01 +00:00
|
|
|
|
.7 jmp (K.StrFTime.JMP,x)
|
2017-08-24 06:47:31 +00:00
|
|
|
|
|
|
|
|
|
.8 lda #0 Terminate C string
|
2018-10-11 15:23:06 +00:00
|
|
|
|
sta (ZPPtr1)
|
2019-02-20 16:07:43 +00:00
|
|
|
|
clc
|
2017-08-24 06:47:31 +00:00
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
2019-07-22 06:31:01 +00:00
|
|
|
|
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
|
2019-01-04 13:17:31 +00:00
|
|
|
|
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
|
2017-08-24 06:47:31 +00:00
|
|
|
|
*--------------------------------------
|
2019-07-16 15:42:36 +00:00
|
|
|
|
K.StrFTime.A sec Short day of week, 3 chars...
|
|
|
|
|
.HS 90 BCC
|
2017-08-24 06:47:31 +00:00
|
|
|
|
|
2019-07-22 06:31:01 +00:00
|
|
|
|
K.StrFTime.AA clc full DoW
|
2019-07-16 15:42:36 +00:00
|
|
|
|
|
|
|
|
|
lda #K.StrFTime.DAY
|
|
|
|
|
ldx /K.StrFTime.DAY
|
2017-08-24 06:47:31 +00:00
|
|
|
|
ldy #S.Time.WDAY
|
|
|
|
|
bra K.StrFTime.STR
|
|
|
|
|
|
2019-07-16 15:42:36 +00:00
|
|
|
|
K.StrFTime.B sec Short Month, 3 chars....
|
|
|
|
|
.HS 90 BCC
|
2017-08-24 06:47:31 +00:00
|
|
|
|
|
2019-07-16 15:42:36 +00:00
|
|
|
|
K.StrFTime.BB clc full Month....
|
|
|
|
|
|
|
|
|
|
lda #K.StrFTime.MON
|
|
|
|
|
ldx /K.StrFTime.MON
|
2017-08-24 06:47:31 +00:00
|
|
|
|
ldy #S.Time.MONTH
|
|
|
|
|
|
2019-07-16 15:42:36 +00:00
|
|
|
|
K.StrFTime.STR sta ZPPtr4
|
|
|
|
|
stx ZPPtr4+1
|
|
|
|
|
|
|
|
|
|
ldx #15
|
|
|
|
|
bcc .10
|
|
|
|
|
ldx #3
|
|
|
|
|
|
|
|
|
|
.10 lda (ZPPtr3),y get required S.Time field value
|
|
|
|
|
|
2017-08-24 06:47:31 +00:00
|
|
|
|
tay
|
2019-07-16 15:42:36 +00:00
|
|
|
|
beq .2 Illegal value, print ???
|
2017-08-24 06:47:31 +00:00
|
|
|
|
|
2019-07-16 15:42:36 +00:00
|
|
|
|
.1 lda (ZPPtr4)
|
2017-08-24 06:47:31 +00:00
|
|
|
|
sec
|
|
|
|
|
adc ZPPtr4
|
|
|
|
|
sta ZPPtr4
|
2019-07-16 15:42:36 +00:00
|
|
|
|
bcc .11
|
2017-08-24 06:47:31 +00:00
|
|
|
|
inc ZPPtr4+1
|
|
|
|
|
|
2019-07-16 15:42:36 +00:00
|
|
|
|
.11 dey
|
|
|
|
|
bne .1
|
2017-11-06 16:25:40 +00:00
|
|
|
|
.2
|
|
|
|
|
* ldy #0 Y is already 0
|
2017-08-24 06:47:31 +00:00
|
|
|
|
|
|
|
|
|
.3 iny
|
|
|
|
|
lda (ZPPtr4),y
|
2019-06-24 15:32:22 +00:00
|
|
|
|
jsr MEM.PutCharPtr1
|
2017-11-06 16:25:40 +00:00
|
|
|
|
tya
|
2017-08-24 06:47:31 +00:00
|
|
|
|
cmp (ZPPtr4)
|
|
|
|
|
beq .8
|
|
|
|
|
|
|
|
|
|
dex
|
|
|
|
|
bne .3
|
2019-07-16 15:42:36 +00:00
|
|
|
|
|
2017-08-24 06:47:31 +00:00
|
|
|
|
.8 rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
K.StrFTime.II ldy #S.Time.HOUR
|
2018-10-11 15:23:06 +00:00
|
|
|
|
lda (ZPPtr3),y
|
2017-08-24 06:47:31 +00:00
|
|
|
|
cmp #12
|
2019-06-24 15:32:22 +00:00
|
|
|
|
bcc K.StrFTime.addDecA
|
2017-08-24 06:47:31 +00:00
|
|
|
|
sbc #12
|
2019-06-24 15:32:22 +00:00
|
|
|
|
bra K.StrFTime.addDecA
|
|
|
|
|
|
2017-08-24 06:47:31 +00:00
|
|
|
|
K.StrFTime.P ldy #S.Time.HOUR
|
2018-10-11 15:23:06 +00:00
|
|
|
|
lda (ZPPtr3),y
|
2017-08-24 06:47:31 +00:00
|
|
|
|
cmp #12
|
|
|
|
|
bcc .1
|
|
|
|
|
lda #'p'
|
|
|
|
|
.HS 2C bit abs
|
|
|
|
|
.1 lda #'a'
|
2019-06-24 15:32:22 +00:00
|
|
|
|
jsr MEM.PutCharPtr1
|
2017-08-24 06:47:31 +00:00
|
|
|
|
lda #'m'
|
2019-06-24 15:32:22 +00:00
|
|
|
|
jmp MEM.PutCharPtr1
|
|
|
|
|
|
2017-08-24 06:47:31 +00:00
|
|
|
|
K.StrFTime.YY ldy #S.Time.CENTURY
|
|
|
|
|
jsr K.StrFTime.addDecPtr1Y
|
2019-06-24 15:32:22 +00:00
|
|
|
|
|
2019-07-22 06:31:01 +00:00
|
|
|
|
ldx #7 "y"
|
|
|
|
|
K.StrFTime.AtX ldy K.StrFTime.OfsX-7,x
|
2017-08-24 06:47:31 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
K.StrFTime.addDecPtr1Y
|
2018-10-11 15:23:06 +00:00
|
|
|
|
lda (ZPPtr3),y
|
2017-08-24 06:47:31 +00:00
|
|
|
|
K.StrFTime.addDecA
|
2019-07-03 15:25:07 +00:00
|
|
|
|
ldx #2
|
|
|
|
|
ldy #'0'
|
|
|
|
|
clc
|
2019-07-10 15:39:02 +00:00
|
|
|
|
jsr MATH.A2STR10
|
2017-08-24 06:47:31 +00:00
|
|
|
|
|
2019-07-03 15:25:07 +00:00
|
|
|
|
lda A2osX.NumStrBuf
|
|
|
|
|
jsr MEM.PutCharPtr1
|
|
|
|
|
lda A2osX.NumStrBuf+1
|
2019-06-24 15:32:22 +00:00
|
|
|
|
jmp MEM.PutCharPtr1
|
2017-08-24 06:47:31 +00:00
|
|
|
|
*--------------------------------------
|
2019-07-16 15:42:36 +00:00
|
|
|
|
K.StrFTime.DAY >PSTR "???"
|
|
|
|
|
>PSTR "Monday"
|
2017-08-24 06:47:31 +00:00
|
|
|
|
>PSTR "Tuesday"
|
|
|
|
|
>PSTR "Wednesday"
|
|
|
|
|
>PSTR "Thursday"
|
|
|
|
|
>PSTR "Friday"
|
|
|
|
|
>PSTR "Saturday"
|
|
|
|
|
>PSTR "Sunday"
|
|
|
|
|
*--------------------------------------
|
2019-07-16 15:42:36 +00:00
|
|
|
|
K.StrFTime.MON >PSTR "???"
|
|
|
|
|
>PSTR "January"
|
2017-08-24 06:47:31 +00:00
|
|
|
|
>PSTR "February"
|
|
|
|
|
>PSTR "March"
|
|
|
|
|
>PSTR "April"
|
|
|
|
|
>PSTR "May"
|
|
|
|
|
>PSTR "June"
|
|
|
|
|
>PSTR "July"
|
|
|
|
|
>PSTR "August"
|
|
|
|
|
>PSTR "September"
|
|
|
|
|
>PSTR "October"
|
|
|
|
|
>PSTR "November"
|
|
|
|
|
>PSTR "December"
|
|
|
|
|
*--------------------------------------
|
2016-08-30 20:26:19 +00:00
|
|
|
|
MAN
|
2018-11-17 17:17:13 +00:00
|
|
|
|
SAVE USR/SRC/SYS/KERNEL.S.TIME
|
|
|
|
|
LOAD USR/SRC/SYS/KERNEL.S
|
2016-08-30 20:26:19 +00:00
|
|
|
|
ASM
|