Skip to content

Commit 745afbc

Browse files
committed
Ajout d'un test pour la validité du mois affiché
1 parent a3666a2 commit 745afbc

File tree

2 files changed

+18
-5
lines changed

2 files changed

+18
-5
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
[![build](https://github.com/oric-software/datetime/actions/workflows/main.yml/badge.svg)](https://github.com/orix-software/datetime/actions/workflows/main.yml)
1+
[![build](https://github.com/orix-software/datetime/actions/workflows/main.yml/badge.svg)](https://github.com/orix-software/datetime/actions/workflows/main.yml)
22

33
# Description
44
Utility to display or set the date and time from a DS1501

src/main.s

+17-4
Original file line numberDiff line numberDiff line change
@@ -258,10 +258,26 @@ typedef .struct ds1501
258258
sta buffer+1
259259

260260
lda ds1501::month
261+
; Conversion BCD -> binaire simplifiée
261262
cmp #$10
262263
bcc *+4
263264
sbc #06
264265

266+
; Vérifie que le mois est < 13
267+
cmp #13
268+
bcc month
269+
270+
; Erreur numéro de mois incorrect,
271+
; on affiche la valeur
272+
lda ds1501::month
273+
jsr byte2str
274+
stx buffer+3
275+
sta buffer+4
276+
lda #'?'
277+
sta buffer+5
278+
bne century
279+
280+
month:
265281
asl
266282
asl
267283
tax
@@ -274,10 +290,7 @@ typedef .struct ds1501
274290
cpy #$02
275291
bne loop_month
276292

277-
; jsr byte2str
278-
; stx buffer+3
279-
; sta buffer+4
280-
293+
century:
281294
lda ds1501::century
282295
jsr byte2str
283296
stx buffer+6+2

0 commit comments

Comments
 (0)