Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support ProDOS 2.5 extended file dates #169

Closed
inexorabletash opened this issue Oct 16, 2019 · 6 comments
Closed

Support ProDOS 2.5 extended file dates #169

inexorabletash opened this issue Oct 16, 2019 · 6 comments
Labels
Good First Bug Approachable project for a new contributor ProDOS 2.5 Specific to P8 2.5 additions (dates, drives, etc)
Milestone

Comments

@inexorabletash
Copy link
Collaborator

ProDOS 2.5 smuggles in a few extra year bits

Add support in the date decode routine, hereabouts: https://github.com/a2stuff/a2d/blob/master/desktop/desktop_main.s#L8223

There may be other places...

@inexorabletash inexorabletash added ProDOS 2.5 Specific to P8 2.5 additions (dates, drives, etc) Good First Bug Approachable project for a new contributor labels Oct 16, 2019
@inexorabletash
Copy link
Collaborator Author

inexorabletash commented Jan 1, 2020

Specifically per @JohnMBrooks - "Basic displays extended dates (10-bit year 1940 to 2964) by appending the 3 top bits from the hour byte to the 7-bit year"

So old GET/SET_FILE_INFO, mod/create_date/time and File Entry creation/last_mod fields:

       byte 1            byte 0
  7 6 5 4 3 2 1 0   7 6 5 4 3 2 1 0
 +-+-+-+-+-+-+-+-+ +-+-+-+-+-+-+-+-+
 |    Year     |  Month  |   Day   |
 +-+-+-+-+-+-+-+-+ +-+-+-+-+-+-+-+-+

       byte 1            byte 0
  7 6 5 4 3 2 1 0   7 6 5 4 3 2 1 0
 +-+-+-+-+-+-+-+-+ +-+-+-+-+-+-+-+-+
 |0 0 0|  Hour   | |0 0|  Minute   |
 +-+-+-+-+-+-+-+-+ +-+-+-+-+-+-+-+-+

For files created with 2.5, this becomes:

       byte 1            byte 0
  7 6 5 4 3 2 1 0   7 6 5 4 3 2 1 0
 +-+-+-+-+-+-+-+-+ +-+-+-+-+-+-+-+-+
 |    Year     |  Month  |   Day   |
 +-+-+-+-+-+-+-+-+ +-+-+-+-+-+-+-+-+

       byte 1            byte 0
  7 6 5 4 3 2 1 0   7 6 5 4 3 2 1 0
 +-+-+-+-+-+-+-+-+ +-+-+-+-+-+-+-+-+
 |YearX|  Hour   | |0 0|  Minute   |
 +-+-+-+-+-+-+-+-+ +-+-+-+-+-+-+-+-+

Where the YearX bits are prepended to the Year bits, giving 10 bits range total (0...1023). The date is stored -1900, so this gives dates 1900 through 2923. 🎉

Proposed algorithm:

  • If (DateLo | DateHi) == 0
    • Final Year = 0
  • Else, if YearX is non-zero
    • Final Year = 1900 + Year + (YearX << 7)
  • Else, if Year < 40
    • Final Year = 2000 + Year (per ProDOS Tech Note # 28)
  • Else
    • Final Year = 1900 + Year

inexorabletash added a commit that referenced this issue Jan 2, 2020
Also improve install script output

This is done with an eye towards issue #169
@inexorabletash
Copy link
Collaborator Author

For posterity: ProDOS 8 2.4.2 SET_FILE_INFO calls seemingly fail to set the modified date if the upper byte is clear, i.e. if the year is 1900 (or 2000, if you follow Tech Note #28) and the month is < 8.

@c0mmander8
Copy link
Contributor

c0mmander8 commented Jul 7, 2020

The ProDOS 2.5 extended date and time format seems to have changed. Please see https://prodos8.com/releases/prodos-25/.

@inexorabletash
Copy link
Collaborator Author

That page is talking about the global page format. This is issue is talking about the file metadata format. Unfortunately in 2.5 they differ from each other.

@inexorabletash inexorabletash changed the title Support ProDOS 2.5 extended dates Support ProDOS 2.5 extended file dates Jul 7, 2020
@inexorabletash
Copy link
Collaborator Author

You were right, it has changed. The code will need updating.

At least the global page/file stamp formats are the same now.

inexorabletash added a commit that referenced this issue Jul 12, 2020
The ProDOS 2.5 date format changed at alpha 4 - handle the new format:
https://prodos8.com/releases/prodos-25/

Also, unify date/time parsing between file strings and the clock.

NOTE: DOW for the clock is only valid for years 1900-2155.

NOTE2: The new date handling is not extensively tested yet. I need to
create a corpus of files with various dates in the new format.

Resolves #169
@inexorabletash
Copy link
Collaborator Author

Should be fixed by 92c0414

@inexorabletash inexorabletash added this to the 1.2 milestone Feb 6, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Good First Bug Approachable project for a new contributor ProDOS 2.5 Specific to P8 2.5 additions (dates, drives, etc)
Projects
None yet
Development

No branches or pull requests

2 participants