Kernel 0.93++

This commit is contained in:
Rémy GIBERT 2020-01-21 08:34:32 +01:00
parent 4e938bfdb2
commit a5813ba876
7 changed files with 488 additions and 452 deletions

View File

@ -248,10 +248,10 @@ SYS.StrLwr .EQ $8A
SYS.StrCmp .EQ $8C
SYS.StrCaseCmp .EQ $8E
SYS.Time .EQ $90
SYS.CTime2Time .EQ $92
SYS.PTime2Time .EQ $94
SYS.StrFTime .EQ $96
* .EQ $90
* .EQ $92
* .EQ $94
* .EQ $96
SYS.LoadLib .EQ $98
SYS.UnloadLib .EQ $9A
@ -278,10 +278,10 @@ SYS.SetEnv .EQ $BA
SYS.GetEnv .EQ $BC
SYS.UnsetEnv .EQ $BE
*--------------------------------------
* .EQ $C0
* .EQ $C2
* .EQ $C4
* .EQ $C6
SYS.Time .EQ $C0
SYS.StrFTime .EQ $C2
SYS.PTime2Time .EQ $C4
SYS.CTime2Time .EQ $C6
SYS.MD5 .EQ $C8
SYS.MD5Init .EQ $CA

View File

@ -126,7 +126,7 @@ K.Buf256 .EQ $1100
K.IOBuf .EQ $1200
*--------------------------------------
Mem.MHiMem .EQ A2osX.SYSCALL
Mem.XHiMem .EQ $B000
Mem.XHiMem .EQ $A000
DevMgr.HiMem .EQ $FFFA Protect IRQ vectors in Aux LC
*--------------------------------------
H.BIN.T .EQ 0

View File

@ -88,10 +88,10 @@ K.SYSCALL .DA 0 $00
.DA K.StrCmp
.DA K.StrCaseCmp
.DA K.Time $90
.DA K.CTime2Time
.DA K.PTime2Time
.DA K.StrFTime
.DA 0 $90
.DA 0
.DA 0
.DA 0
.DA K.LoadLib
.DA K.UnloadLib
.DA K.LoadDrv
@ -115,10 +115,10 @@ K.SYSCALL .DA 0 $00
.DA K.GetEnv
.DA K.UnsetEnv
.DA 0 $C0
.DA 0
.DA 0
.DA 0
.DA K.Time $C0
.DA K.StrFTime
.DA K.PTime2Time
.DA K.CTime2Time
.DA K.MD5
.DA K.MD5Init
.DA K.MD5Update
@ -361,13 +361,13 @@ K.SYSCALL.BANK .DA #RRAMWRAMBNK1 $00
.DA #RRAMWRAMBNK2
.DA #$80
.DA #RRAMWRAMBNK2 $C0
.DA #0 $C0
.DA #$80
.DA #RRAMWRAMBNK2
.DA #0
.DA #$80
.DA #RRAMWRAMBNK2
.DA #0
.DA #$80
.DA #RRAMWRAMBNK2
.DA #0
.DA #$80
.DA #$C0 $C8 : MD5X
.DA #$80

View File

@ -98,6 +98,17 @@ SHARED.TXTPTR.Next
SHARED.TXTPTR.Next.9
rts
*--------------------------------------
SHARED.FORPNT.GetNext
sta CLRWRITEAUX
sta (FORPNT)
sta SETWRITEAUX
SHARED.FORPNT.Next
inc FORPNT
bne SHARED.FORPNT.Next.9
inc FORPNT+1
SHARED.FORPNT.Next.9
rts
*--------------------------------------
SHARED.SPtr1PPtr2
>STYA ZPPtr1
>PULLW ZPPtr2

View File

@ -1,12 +1,5 @@
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
CENTURY0 .EQ 19
YEAR0 .EQ 70
DAY0 .EQ 4 day 0 was a thursday
*/--------------------------------------
* # Time
* Get System Time in Buffer
@ -22,280 +15,9 @@ K.Time >PULLW FORPNT
>MLICALL MLIGETTIME
>LDYAI DATELO
>STYA TXTPTR
bra K.PTime2Time.I
*/--------------------------------------
* # PTime2Time
* Convert ProDOS Time To S.TIME
* ## C
* `int PTime2Time (long* ptime, S.TIME* timer);`
* ## ASM
* `>PUSHW ptime`
* `>PUSHW timer`
* `>SYSCALL PTime2Time`
* ## RETURN VALUE
*\--------------------------------------
K.PTime2Time >PULLW FORPNT
>PULLW TXTPTR
K.PTime2Time.I ldy #1
lda (TXTPTR),y Get Year
lsr C is high bit of month
ldy #S.Time.YEAR
sta (FORPNT),y set year
sta ARG32+3 for computing Century/WDAY later
lda (TXTPTR) Get Month/day
pha save Day
ror
lsr
lsr
lsr
lsr
ldy #S.Time.MONTH
sta (FORPNT),y set month
pla get back day
and #$1F
iny
sta (FORPNT),y set day
lda ARG32+3 get back year
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
sta (FORPNT) set Century
sta ARG32+2 for computing WDAY later
ldy #2
lda (TXTPTR),y Get Min
tax
iny
lda (TXTPTR),y Get Hour
ldy #S.Time.HOUR
sta (FORPNT),y set hour
iny
txa
sta (FORPNT),y set min
iny
lda #0
sta (FORPNT),y set seconds (ProDOS does not provide it)
*--------------------------------------
* 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
lda #CENTURY0
sta ARG32
lda #YEAR0
sta ARG32+1
.1 ldy ARG32
lda ARG32+1
cpy ARG32+2
bne .2
cmp ARG32+3
beq .4
.2 jsr TIME.IsLeapYearYA 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
*--------------------------------------
.4 ldy #S.Time.MONTH
lda (FORPNT),y get month
tax
dex don't include actual month
beq .71
.5 clc assume NO leap
lda K.StrFTime.MDAY-1,x get day count in this month
bne .6 february ?
ldy ARG32+2
lda ARG32+3
jsr TIME.IsLeapYearYA CS = Leap
.6 pla
adc K.StrFTime.MDAY-1,x
cmp #7
bcc .7
sbc #7
ldx #SYS.PTime2Time
.7 pha
dex
bne .5
.71 pla
ldy #S.Time.DAY
clc
adc (FORPNT),y get day in month (1..31)
dec adjust range 0.30 for MOD 7
.8 cmp #7 MOD 7
bcc .80
sbc #7
bra .8
.80 inc adjust range 1..7
ldy #S.Time.WDAY
sta (FORPNT),y
clc
rts
*/--------------------------------------
* # CTime2Time
* Convert CTime Time To S.TIME
* ## C
* `int CTime2Time (long* ctime, S.TIME* timer);`
* ## ASM
* `>PUSHW timer`
* `>LDYA ctime`
* `>SYSCALL CTime2Time`
* ## RETURN VALUE
*\--------------------------------------
K.CTime2Time jsr SHARED.SPtr1PPtr2
ldy #3
.1 lda (ZPPtr1),y
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
jsr MATH.DIVMOD32 ARG32 = Days, TMP32 = remaining secs
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
.2 tay
sec
sbc #7
bcs .2
inx
bne .2
tya
ldy #S.Time.WDAY
sta (ZPPtr2),y
ldy #CENTURY0
sty ZPPtr3
lda #YEAR0
sta ZPPtr3+1
K.CTime2Time.Year
.1 ldy ZPPtr3
lda ZPPtr3+1
jsr TIME.IsLeapYearYA if Leap year CS
rol Toggle Carry
eor #1
lsr
lda ARG32
sbc #365
pha
lda ARG32+1
sbc /365
bcc .2
sta ARG32+1
pla
sta ARG32
inc ZPPtr3
lda ZPPtr3
cmp #100
bne .1
stz ZPPtr3
inc ZPPtr3+1
bne .1
.2 pla
lda ZPPtr3+1
* ldy #S.Time.CENTURY
sta (ZPPtr2)
ldy #S.Time.YEAR
lda ZPPtr3
sta (ZPPtr2),y
K.CTime2Time.HMS
ldx #3
.1 lda TMP32,x
sta ARG32,x
dex
bpl .1
ldy #S.TIME.SECOND
jsr .2
dey #S.TIME.MINUTE
jsr .2
dey #S.TIME.HOUR
lda ARG32
sta (ZPPtr2),y
clc
rts
.2 phy
lda #60
jsr MATH.A2ACC32
jsr MATH.DIVMOD32
ply
lda TMP32
sta (ZPPtr2),y
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
*--------------------------------------
TIME.IsLeapYearYA
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)
.8 clc not leap (1900)
rts
.1 and #$3 mod 4 = 0 ?
bne .8
.9 sec Leap
rts
*--------------------------------------
K.StrFTime.MDAY .DA #3,#0,#3,#2,#3,#2,#3,#3,#2,#3,#2,#3
bra TIME.JMP
*/--------------------------------------
* # StrFTime
* ## C
@ -323,154 +45,45 @@ K.StrFTime.MDAY .DA #3,#0,#3,#2,#3,#2,#3,#3,#2,#3,#2,#3
* ## RETURN VALUE
* none. always succeed.
*\--------------------------------------
K.StrFTime >PULLW ZPPtr3 timeptr
>PULLW ZPPtr2 format
>PULLW ZPPtr1 ptr
K.StrFTime >PULLW ZPPtr1 timeptr
*/--------------------------------------
* # PTime2Time
* Convert ProDOS Time To S.TIME
* ## C
* `int PTime2Time (long* ptime, S.TIME* timer);`
* ## ASM
* `>PUSHW ptime`
* `>PUSHW timer`
* `>SYSCALL PTime2Time`
* ## RETURN VALUE
*\--------------------------------------
K.PTime2Time
*/--------------------------------------
* # CTime2Time
* Convert CTime Time To S.TIME
* ## C
* `int CTime2Time (long* ctime, S.TIME* timer);`
* ## ASM
* `>PUSHW ctime`
* `>PUSHW timer`
* `>SYSCALL CTime2Time`
* ## RETURN VALUE
*\--------------------------------------
K.CTime2Time >PULLW FORPNT
>PULLW TXTPTR
.1 jsr SHARED.GetCharPtr2
beq .8
cmp #'%'
beq .2
jsr SHARED.PutCharPtr1
bra .1
.2 ldx #K.StrFTime.Cnt-1
jsr SHARED.GetCharPtr2
beq .8
.3 cmp K.StrFTime.Tbl,x
beq .4
dex
bpl .3
bra .1
.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
sta (ZPPtr1)
clc
TIME.JMP sta SETREADAUX
sta SETWRITEAUX
jsr .1
sta CLRREADAUX
sta CLRWRITEAUX
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
lda #K.StrFTime.DAY
ldx /K.StrFTime.DAY
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....
lda #K.StrFTime.MON
ldx /K.StrFTime.MON
ldy #S.Time.MONTH
K.StrFTime.STR sta ZPPtr4
stx ZPPtr4+1
ldx #15
bcc .10
ldx #3
.10 lda (ZPPtr3),y get required S.Time field value
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
jsr SHARED.PutCharPtr1
tya
cmp (ZPPtr4)
beq .8
dex
bne .3
.8 rts
*--------------------------------------
K.StrFTime.II ldy #S.Time.HOUR
lda (ZPPtr3),y
cmp #12
bcc K.StrFTime.addDecA
sbc #12
bra K.StrFTime.addDecA
K.StrFTime.P ldy #S.Time.HOUR
lda (ZPPtr3),y
cmp #12
bcc .1
lda #'p'
.HS 2C bit abs
.1 lda #'a'
jsr SHARED.PutCharPtr1
lda #'m'
jmp SHARED.PutCharPtr1
K.StrFTime.YY ldy #S.Time.CENTURY
jsr K.StrFTime.addDecPtr1Y
ldx #7 "y"
K.StrFTime.AtX ldy K.StrFTime.OfsX-7,x
*--------------------------------------
K.StrFTime.addDecPtr1Y
lda (ZPPtr3),y
K.StrFTime.addDecA
ldx #2
ldy #'0'
clc
jsr MATH.A2STR10
lda A2osX.NumStrBuf
jsr SHARED.PutCharPtr1
lda A2osX.NumStrBuf+1
jmp SHARED.PutCharPtr1
*--------------------------------------
K.StrFTime.DAY >PSTR "???"
>PSTR "Monday"
>PSTR "Tuesday"
>PSTR "Wednesday"
>PSTR "Thursday"
>PSTR "Friday"
>PSTR "Saturday"
>PSTR "Sunday"
*--------------------------------------
K.StrFTime.MON >PSTR "???"
>PSTR "January"
>PSTR "February"
>PSTR "March"
>PSTR "April"
>PSTR "May"
>PSTR "June"
>PSTR "July"
>PSTR "August"
>PSTR "September"
>PSTR "October"
>PSTR "November"
>PSTR "December"
.1 jmp (.2-SYS.StrFTime,x)
.2 .DA K.StrFTime.I
.DA K.PTime2Time.I
.DA K.CTime2Time.I
*--------------------------------------
MAN
SAVE USR/SRC/SYS/KERNEL.S.TIME

411
SYS/KERNEL.S.TIMEX.txt Normal file
View File

@ -0,0 +1,411 @@
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
CENTURY0 .EQ 19
YEAR0 .EQ 70
DAY0 .EQ 4 day 0 was a thursday
*--------------------------------------
K.StrFTime.I
.1 jsr SHARED.GetCharPtr2
beq .8
cmp #'%'
beq .2
jsr SHARED.PutCharPtr1
bra .1
.2 ldx #K.StrFTime.Cnt-1
jsr SHARED.GetCharPtr2
beq .8
.3 cmp K.StrFTime.Tbl,x
beq .4
dex
bpl .3
bra .1
.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
sta (ZPPtr1)
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
lda #K.StrFTime.DAY
ldx /K.StrFTime.DAY
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....
lda #K.StrFTime.MON
ldx /K.StrFTime.MON
ldy #S.Time.MONTH
K.StrFTime.STR sta ZPPtr4
stx ZPPtr4+1
ldx #15
bcc .10
ldx #3
.10 lda (ZPPtr3),y get required S.Time field value
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
jsr SHARED.PutCharPtr1
tya
cmp (ZPPtr4)
beq .8
dex
bne .3
.8 rts
*--------------------------------------
K.StrFTime.II ldy #S.Time.HOUR
lda (ZPPtr3),y
cmp #12
bcc K.StrFTime.addDecA
sbc #12
bra K.StrFTime.addDecA
K.StrFTime.P ldy #S.Time.HOUR
lda (ZPPtr3),y
cmp #12
bcc .1
lda #'p'
.HS 2C bit abs
.1 lda #'a'
jsr SHARED.PutCharPtr1
lda #'m'
jmp SHARED.PutCharPtr1
K.StrFTime.YY ldy #S.Time.CENTURY
jsr K.StrFTime.addDecPtr1Y
ldx #7 "y"
K.StrFTime.AtX ldy K.StrFTime.OfsX-7,x
*--------------------------------------
K.StrFTime.addDecPtr1Y
lda (ZPPtr3),y
K.StrFTime.addDecA
ldx #2
ldy #'0'
clc
jsr MATH.A2STR10
lda A2osX.NumStrBuf
jsr SHARED.PutCharPtr1
lda A2osX.NumStrBuf+1
jmp SHARED.PutCharPtr1
*--------------------------------------
K.StrFTime.DAY >PSTR "???"
>PSTR "Monday"
>PSTR "Tuesday"
>PSTR "Wednesday"
>PSTR "Thursday"
>PSTR "Friday"
>PSTR "Saturday"
>PSTR "Sunday"
*--------------------------------------
K.StrFTime.MON >PSTR "???"
>PSTR "January"
>PSTR "February"
>PSTR "March"
>PSTR "April"
>PSTR "May"
>PSTR "June"
>PSTR "July"
>PSTR "August"
>PSTR "September"
>PSTR "October"
>PSTR "November"
>PSTR "December"
*--------------------------------------
K.StrFTime.MDAY .DA #3,#0,#3,#2,#3,#2,#3,#3,#2,#3,#2,#3
*--------------------------------------
K.PTime2Time.I ldy #1
lda (TXTPTR),y Get Year
lsr C is high bit of month
ldy #S.Time.YEAR
sta (FORPNT),y set year
sta ARG32+3 for computing Century/WDAY later
lda (TXTPTR) Get Month/day
pha save Day
ror
lsr
lsr
lsr
lsr
ldy #S.Time.MONTH
sta (FORPNT),y set month
pla get back day
and #$1F
iny
sta (FORPNT),y set day
lda ARG32+3 get back year
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
sta (FORPNT) set Century
sta ARG32+2 for computing WDAY later
ldy #2
lda (TXTPTR),y Get Min
tax
iny
lda (TXTPTR),y Get Hour
ldy #S.Time.HOUR
sta (FORPNT),y set hour
iny
txa
sta (FORPNT),y set min
iny
lda #0
sta (FORPNT),y set seconds (ProDOS does not provide it)
*--------------------------------------
* 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
lda #CENTURY0
sta ARG32
lda #YEAR0
sta ARG32+1
.1 ldy ARG32
lda ARG32+1
cpy ARG32+2
bne .2
cmp ARG32+3
beq .4
.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
*--------------------------------------
.4 ldy #S.Time.MONTH
lda (FORPNT),y get month
tax
dex don't include actual month
beq .71
.5 clc assume NO leap
lda K.StrFTime.MDAY-1,x get day count in this month
bne .6 february ?
ldy ARG32+2
lda ARG32+3
jsr TIMEX.IsLeap CS = Leap
.6 pla
adc K.StrFTime.MDAY-1,x
cmp #7
bcc .7
sbc #7
.7 pha
dex
bne .5
.71 pla
ldy #S.Time.DAY
clc
adc (FORPNT),y get day in month (1..31)
dec adjust range 0.30 for MOD 7
.8 cmp #7 MOD 7
bcc .80
sbc #7
bra .8
.80 inc adjust range 1..7
ldy #S.Time.WDAY
sta (FORPNT),y
clc
rts
*--------------------------------------
K.CTime2Time.I ldy #3
.1 lda (ZPPtr1),y
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
jsr MATH.DIVMOD32 ARG32 = Days, TMP32 = remaining secs
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
.2 tay
sec
sbc #7
bcs .2
inx
bne .2
tya
ldy #S.Time.WDAY
sta (ZPPtr2),y
ldy #CENTURY0
sty ZPPtr3
lda #YEAR0
sta ZPPtr3+1
K.CTime2Time.Year
.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
sta ARG32+1
pla
sta ARG32
inc ZPPtr3
lda ZPPtr3
cmp #100
bne .1
stz ZPPtr3
inc ZPPtr3+1
bne .1
.2 pla
lda ZPPtr3+1
* ldy #S.Time.CENTURY
sta (ZPPtr2)
ldy #S.Time.YEAR
lda ZPPtr3
sta (ZPPtr2),y
K.CTime2Time.HMS
ldx #3
.1 lda TMP32,x
sta ARG32,x
dex
bpl .1
ldy #S.TIME.SECOND
jsr .2
dey #S.TIME.MINUTE
jsr .2
dey #S.TIME.HOUR
lda ARG32
sta (ZPPtr2),y
clc
rts
.2 phy
lda #60
jsr MATH.A2ACC32
jsr MATH.DIVMOD32
ply
lda TMP32
sta (ZPPtr2),y
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)
.8 clc not leap (1900)
rts
.1 and #$3 mod 4 = 0 ?
bne .8
.9 sec Leap
rts
*--------------------------------------
MAN
SAVE USR/SRC/SYS/KERNEL.S.TIMEX
LOAD USR/SRC/SYS/KERNEL.S
ASM

View File

@ -58,6 +58,7 @@ A2osX.AUXH .DA #0
A2osX.AUXH.B .PH Mem.XHiMem
.INB USR/SRC/SYS/KERNEL.S.TERM
.INB USR/SRC/SYS/KERNEL.S.MD5X
.INB USR/SRC/SYS/KERNEL.S.TIMEX
.EP
A2osX.AUXH.S .EQ *-A2osX.AUXH.B
@ -91,10 +92,10 @@ A2osX.D2 .DA #0
A2osX.D2.B .PH $D000
.DA #RRAMWRAMBNK2
.INB USR/SRC/SYS/KERNEL.S.STRING
.INB USR/SRC/SYS/KERNEL.S.TIME
.INB USR/SRC/SYS/KERNEL.S.BIN
.INB USR/SRC/SYS/KERNEL.S.PS
.INB USR/SRC/SYS/KERNEL.S.ARG
.INB USR/SRC/SYS/KERNEL.S.ENV
.EP
A2osX.D2.S .EQ *-A2osX.D2.B
@ -110,13 +111,13 @@ A2osX.E0.B .PH $E000
.INB USR/SRC/SYS/KERNEL.S.SHARED
.INB USR/SRC/SYS/KERNEL.S.STDIO2
.INB USR/SRC/SYS/KERNEL.S.PWD
.INB USR/SRC/SYS/KERNEL.S.TIME
********* TMP ***** go to A2osX.D1
.INB USR/SRC/SYS/KERNEL.S.IO
.INB USR/SRC/SYS/KERNEL.S.PIPE
.INB USR/SRC/SYS/KERNEL.S.PFT
********* TMP ***** go to A2osX.D2
.INB USR/SRC/SYS/KERNEL.S.ENV
*--------------------------------------
DevMgr.Timer .BS 1
DevMgr.ASCREEN .BS 1
DevMgr.SCRNDEVS .BS K.TTY.MAX+2 1-8=VT100, 9=GFX, 0=console
@ -127,12 +128,12 @@ DevMgr.DevIdx .DA #1
DevMgr.FreeMem .EQ *
.EP
A2osX.E0.S .EQ *-A2osX.E0.B
*--------------------------------------
.AS "PAKME" TAG
.DA $2000 BIN ORG
.DA #7 Chunk Count
.DA PAKME.Table Chunks
*--------------------------------------
.INB USR/SRC/SYS/KERNEL.S.CTRL
MAN
SAVE USR/SRC/SYS/KERNEL.S