Fix asctime() to properly print years 1000 through 9999.

Also, use a leading space rather than a leading 0 in days 1 through 9.

This fixes the libca11.c test case.
This commit is contained in:
Stephen Heumann 2018-03-09 13:10:53 -06:00
parent 73f04eaab4
commit a77e44d7b5

View File

@ -137,7 +137,10 @@ tm_wday equ 12
ldy #tm_mday convert the day to a string ldy #tm_mday convert the day to a string
lda [timeptr],Y lda [timeptr],Y
jsr mkstr jsr mkstr
sta str+8 bit #$00CF check for leading '0'
bne lb1
and #$FFEF convert leading '0' to ' '
lb1 sta str+8
ldy #tm_hour convert the hour to a string ldy #tm_hour convert the hour to a string
lda [timeptr],Y lda [timeptr],Y
jsr mkstr jsr mkstr
@ -151,17 +154,21 @@ tm_wday equ 12
jsr mkstr jsr mkstr
sta str+17 sta str+17
ldy #tm_year convert the year to a string ldy #tm_year convert the year to a string
lda #'91'
sta str+20
lda [timeptr],Y lda [timeptr],Y
cmp #100 ldy #19
blt lb1 sec
ldx #'02' yr1 iny
stx str+20 sbc #100
sec bpl yr1
sbc #100 clc
lb1 jsr mkstr yr2 dey
adc #100
bmi yr2
jsr mkstr
sta str+22 sta str+22
tya
jsr mkstr
sta str+20
lla timeptr,str lla timeptr,str
plb plb