Time API:Work in progress

This commit is contained in:
Rémy GIBERT 2016-09-01 07:42:28 +02:00
parent 05b999f639
commit e00d74623c

View File

@ -158,10 +158,38 @@ S.CTime2Time >PULLW ZPQuickPtr1
lda #YEAR0 lda #YEAR0
sta S.CTime.Year sta S.CTime.Year
* si l'année est divisible par 4 et non divisible par 100, ou .9 ldy S.CTime.Century
* si l'année est divisible par 400. 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.DWORD .BS 4
S.CTime.DivDay .BS 2 S.CTime.DivDay .BS 2
S.CTime.ModDay .BS 3 S.CTime.ModDay .BS 3
@ -264,10 +292,26 @@ S.StrFTime
clc clc
rts 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
clc tya year = 00, get century in a
and #$3 mod 4 = 0 ?
beq .9 leap year
.8 sec not leap
rts
.1 and #$3 mod 4 = 0 ?
bne .8
.9 clc Leap
rts rts
*-------------------------------------- *--------------------------------------
MAN MAN