Skip to content
This repository has been archived by the owner on May 23, 2023. It is now read-only.

Commit

Permalink
Fix crash if drive returns nonsensical day of week
Browse files Browse the repository at this point in the history
  • Loading branch information
mnaberez committed Dec 9, 2015
1 parent e02c579 commit e5a431c
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
7 changes: 7 additions & 0 deletions hd/CHANGES.rst
@@ -0,0 +1,7 @@
2015-12-09
----------

- ``SET HD CLOCK``: Added an ``IF`` statement to end of line 30 to fix a
crash. After the RTC battery was replaced in a CMD HD, the day of week
returned a nonsensical value (variable ``WD``) that was out of bounds
of the ``WD$()`` array, which caused ``?BAD SUBSCRIPT ERROR IN 1100``.
9 changes: 8 additions & 1 deletion hd/utils/set_hd_clock.txt
@@ -1,4 +1,11 @@
;set_hd_clock.prg ==1c01==
;
;2015-12-09
; Added an IF statement to end of line 30 to fix a crash. After the battery
; was replaced in a CMD HD, the day of week returned a nonsensical value
; (variable WD) that was out of bounds of the WD$() array, which caused
; ?BAD SUBSCRIPT ERROR IN 1100.
;
0 rem set real-time clock by doug cotton (c) 1990 by creative micro designs, inc.
1 poke53280,0:poke53281,0:poke650,128:print"{clr}":dimwd$(6)
2 wd$(0)="sun.":wd$(1)="mon."
Expand All @@ -8,7 +15,7 @@
6 input"cmd device number";dv
10 open15,dv,15
20 print#15,"t-rd"
30 get#15,wd$:wd=asc(wd$+chr$(0))
30 get#15,wd$:wd=asc(wd$+chr$(0)):ifwd>6thenwd=0
31 get#15,yr$:yr=asc(yr$+chr$(0))
32 get#15,mo$:mo=asc(mo$+chr$(0))
33 get#15,da$:da=asc(da$+chr$(0))
Expand Down

0 comments on commit e5a431c

Please sign in to comment.