Skip to content

Commit

Permalink
Make it possible to set date in December
Browse files Browse the repository at this point in the history
An off-by-one error prevented using the DATE shell command (and maybe
others?) to set a date in December.

It was caused by the actual Month value (1-indexed) being used an index
for for the `maxday` array.
  • Loading branch information
Terr committed Aug 1, 2023
1 parent eb722c8 commit 103e9bb
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/dos/dos.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1520,7 +1520,7 @@ static Bitu DOS_21Handler(void) {
if (reg_cx % 4 == 0 && (reg_cx % 100 != 0 || reg_cx % 400 == 0))
maxday[1]++;

if (reg_cx < 1980 || reg_cx > 9999 || reg_dh < 1 || reg_dh > 12 || reg_dl < 1 || reg_dl > maxday[reg_dh])
if (reg_cx < 1980 || reg_cx > 9999 || reg_dh < 1 || reg_dh > 12 || reg_dl < 1 || reg_dl > maxday[reg_dh - 1])
{
reg_al = 0xff; // error!
break; // done
Expand Down

0 comments on commit 103e9bb

Please sign in to comment.