From e00d74623c77a4fc873a7a5b97bda4e52146d194 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9my=20GIBERT?= Date: Thu, 1 Sep 2016 07:42:28 +0200 Subject: [PATCH] Time API:Work in progress --- SYS/KERNEL.S.TIME.txt | 54 +++++++++++++++++++++++++++++++++++++++---- 1 file changed, 49 insertions(+), 5 deletions(-) diff --git a/SYS/KERNEL.S.TIME.txt b/SYS/KERNEL.S.TIME.txt index fd919864..22fa4fd1 100644 --- a/SYS/KERNEL.S.TIME.txt +++ b/SYS/KERNEL.S.TIME.txt @@ -158,10 +158,38 @@ S.CTime2Time >PULLW ZPQuickPtr1 lda #YEAR0 sta S.CTime.Year -* si l'année est divisible par 4 et non divisible par 100, ou -* si l'année est divisible par 400. +.9 ldy S.CTime.Century + lda S.CTime.Year + jsr S.IsLeapYearYA if Leap year CC + lda S.CTime.DivDay + sbc #365 + pha + lda S.CTime.DivDay+1 + sbc /365 + bcc .10 - + sta S.CTime.DivDay+1 + pla + sta S.CTime.DivDay + + inc S.CTime.Year + lda S.CTime.Year + cmp #100 + bne .9 + stz S.CTime.Year + inc S.CTime.Century + bne .9 + +.10 pla + lda S.CTime.Century +* ldy #S.TIME.CENTURY + sta (ZPQuickPtr2) + ldy #S.TIME.YEAR + lda S.CTime.Year + sta (ZPQuickPtr2),y + + +*-------------------------------------- S.CTime.DWORD .BS 4 S.CTime.DivDay .BS 2 S.CTime.ModDay .BS 3 @@ -264,10 +292,26 @@ S.StrFTime clc rts *-------------------------------------- +* Y = Century +* A = Year (0..99) +* if (year mod 400 = 0) +* or +* if not (year mod 100 = 0) and (year mod 4 = 0) *-------------------------------------- -S.IsLeapYearYA +S.IsLeapYearYA tax Year = 00 ? + bne .1 no + + tya year = 00, get century in a + and #$3 mod 4 = 0 ? + beq .9 leap year + +.8 sec not leap + rts - clc +.1 and #$3 mod 4 = 0 ? + bne .8 + +.9 clc Leap rts *-------------------------------------- MAN