Announcement

Collapse
No announcement yet.

Commodore and old system LHA archive format...

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    #21
    Re: Commodore and old system LHA archive format...

    Originally posted by ratdude747 View Post
    1970. 1/1/70 is the start of unix time.
    Thanks. I was thinking Bell Labs was setup in 1960's for some reason and Unix came around shortly after.
    -- Law of Expanding Memory: Applications Will Also Expand Until RAM Is Full

    Comment


      #22
      Re: Commodore and old system LHA archive format...

      Originally posted by fzabkar View Post
      I created some test files while fiddling with the system date.

      Code:
      TEST1  TXT      18 02-21-16 4:50p test1.txt
      TEST2  TXT      18 02-21-15 4:50p test2.txt
      
      C:\Downloads\Software\LHArc>type test1.txt
      02-21-2016 4:49
      
      C:\Downloads\Software\LHArc>type test2.txt
      02-21-2015 4:49
      
      C:\Downloads\Software\LHArc>debug test.lzh
      -d
      1262:0100 22 25 2D 6C 68 30 2D 12-00 00 00 12 00 00 00 43  "%-lh0-........C
      1262:0110 86 55 48 20 01 09 54 45-53 54 31 2E 54 58 54 AB  .UH ..TEST1.TXT.
      1262:0120 7C 4D 00 00 30 32 2D 32-31 2D 32 30 31 36 20 34  |M..02-21-2016 4
      1262:0130 3A 34 39 20 0D 0A 22 5D-2D 6C 68 30 2D 12 00 00  :49 .."]-lh0-...
      1262:0140 00 12 00 00 00 58 86 55-46 20 01 09 54 45 53 54  .....X.UF ..TEST
      1262:0150 32 2E 54 58 54 BF 8C 4D-00 00 30 32 2D 32 31 2D  2.TXT..M..02-21-
      1262:0160 32 30 31 35 20 34 3A 34-39 20 0D 0A 00      2015 4:49 ...
      
      02-21-2016 4:49 -> 0x48558643 = 0b 0100100 0010101011000011001000011
      02-21-2015 4:49 -> 0x46558658 = 0b 0100011 0010101011000011001011000
      
      
      C:\Downloads\Software\LHArc>type test1.txt
      02-21-2016 5:05
      
      C:\Downloads\Software\LHArc>type test2.txt
      03-21-2016 5:05
      
      C:\Downloads\Software\LHArc>debug test.lzh
      -d
      1262:0100 22 50 2D 6C 68 30 2D 13-00 00 00 13 00 00 00 CA  "P-lh0-.........
      1262:0110 88 55 48 20 01 09 54 45-53 54 31 2E 54 58 54 FF  .UH ..TEST1.TXT.
      1262:0120 C8 4D 00 00 30 32 2D 32-31 2D 32 30 31 36 20 35  .M..02-21-2016 5
      1262:0130 3A 30 35 20 20 0D 0A 22-9B 2D 6C 68 30 2D 13 00  :05 ..".-lh0-..
      1262:0140 00 00 13 00 00 00 D9 88-75 48 20 01 09 54 45 53  ........uH ..TES
      1262:0150 54 32 2E 54 58 54 AE 34-4D 00 00 30 33 2D 32 31  T2.TXT.4M..03-21
      1262:0160 2D 32 30 31 36 20 35 3A-30 35 20 20 0D 0A 00   -2016 5:05 ...
      
      TEST1  TXT      19 02-21-16 5:06p test1.txt
      TEST2  TXT      19 03-21-16 5:06p test2.txt
      I can see how the year/month/day are encoded, at least for the DOS program, but I'm still working on the time stamp.

      Code:
      02-21-2016 5:06 -> 0x485588CA = 0b 0100100 0010 10101 1000100011001010
      03-21-2016 5:06 -> 0x487588D9 = 0b 0100100 0011 10101 1000100011011001
                        year  mth  day    time    
                        - 1980
      But is this date format for your archive that you created with LHA255.exe or for the date format in the archive I posted? It seems LHA (the one Stj linked to) uses a different time format than the one in the custom archive I used. When I tried decoding the year, I couldn't get anything close to what is actually reported by the dosemu after the file is extracted...
      -- Law of Expanding Memory: Applications Will Also Expand Until RAM Is Full

      Comment


        #23
        Re: Commodore and old system LHA archive format...

        Originally posted by fzabkar View Post
        31BA6B94 --> 06-08-96 11:13pm

        30BA 6B94 --> 11-27-95 5:53pm

        Number of days from 11-27-95 to 06-08-96 is about 194.

        0x31BA6B94 - 0x30BA6B94 = 0x1000000

        (194 days) / 0x1000000 = 0.999069214 seconds

        Therefore each increment in the date/time dword corresponds to 1 second.

        So ...

        0x31BA6B94 seconds = 26.4379623 years -> 26th year
        0.4379623 years = 5.2555476 months -> 6th month
        0.2555476 months = 7.77806394 days -> 8th day

        Therefore the date/time appears to be a dword that counts the number of seconds since 1970.
        Did you figure it out? Is this the actual formula to successfully calculate the date / time stamp? I can modify the values with a hex editor and then run JetSetup.exe to see if it extracts the files with the new date, to see if I can try to set the date manually I mean, to make sure we got it figured out. For example, changing it to the 27th year from 1970.

        Is this called Epoch time?
        -- Law of Expanding Memory: Applications Will Also Expand Until RAM Is Full

        Comment


          #24
          Re: Commodore and old system LHA archive format...

          Originally posted by fzabkar View Post
          Here is an experiment you could try. Place the following lines in a BAT file and then execute the batch. The result should be a text file with a date/time stamp corresponding to 01-01-1970 0:00.

          Code:
          echo 01-01-1970 | date
          echo 0:00 | time
          echo 01-01-1970 0:00 > test.txt
          type test.txt
          Use your utility to compress/pack this file. The date/time dword in the LHA archive should be close to 0x00000000.

          Of course you will need to restore your machine's current date and time.

          Edit: I just tried it. Apparently DOS doesn't like 1970. It's too early. :-(

          What happens if you take your custom archive, replace the date/time bytes with zeros and recalculate the 8-bit checksum? How does your custom software report this date/time stamp?

          Code:
          Offset(h) 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
          
          00000000 23 39 2D 6C 68 35 2D 7D 9F 02 00 E8 11 05 00 00 #9-lh5-}Ÿ..è....
          00000010 00 00 00 20 01 0A 6A 65 74 62 62 73 2E 65 78 65 ... ..jetbbs.exe
          00000020 93 F2 20 00 00
          So I don't confuse you guys, I'll tell you what I have:
          JetSetup.exe (Proprietary software, no source code, extracts files from JetBBS.dat)

          JetBBS.dat (Custom archive. I can create custom archives using a modified version of ar from back in the day, but the time / date stamps are just 0000's).

          ar (a very old archiving program that was later renamed to lha because the name ar conflicted with another program. I can use this to create archives that JetSetup.exe can decompress, but it cannot create exact archives (the date/time is missing.).

          The goal is to use ar to extract the files from JetBBS.dat (I can already do this) and then recreate JetBBS.dat and have it be a 1 to 1 exact copy of the original JetBBS.dat file. The only thing that's off is the time stamp.

          When I use ar to create JetBBS.dat, for the time stamp, it uses all 0's. So, to answer your question, when I create a custom JetBBS.dat file and it has four bytes of 0's for the time stamp, JetSetup.exe, running in DOSEmu, creates the files with a time stamp of 12-31-97 4:00PM.
          -- Law of Expanding Memory: Applications Will Also Expand Until RAM Is Full

          Comment


            #25
            Re: Commodore and old system LHA archive format...

            0F 10 11 12h
            00 00 00 01 -> 07-13-98 9:20p
            00 00 00 02 -> 01-24-99 12:40a
            00 00 00 03 -> 08-06-99 6:00a
            00 00 00 10 -> 07-04-06 2:24p
            94 00 00 10 -> 07-04-06 2:26p

            I don't get the last part there. Could there be a flaw with DOSEMU? I add 94 for the first two bytes and we add two minutes??
            -- Law of Expanding Memory: Applications Will Also Expand Until RAM Is Full

            Comment


              #26
              Re: Commodore and old system LHA archive format...

              00 01 00 00 -> 12-31-97 4:04p
              00 02 00 00 -> 12-31-97 4:08p
              00 10 00 00 -> 12-31-97 5:08p (I don't get why the minutes are 08 here)...

              I feel like we're getting somewheres...

              It's a not a DOSEMU issue or anything. I installed DOS 6.22 in VirtualBox on a Windows box and ran the JetSetup program. It shows the same date / time. 12-31-97 5:08p.
              Last edited by Spork Schivago; 02-21-2016, 10:29 PM. Reason: Added content about DOS 6.22
              -- Law of Expanding Memory: Applications Will Also Expand Until RAM Is Full

              Comment


                #27
                Re: Commodore and old system LHA archive format...

                The dword is little-endian, not big-endian, and 9 and 4 are nibbles, not bytes.

                Comment


                  #28
                  Re: Commodore and old system LHA archive format...

                  I mistyped. Been a long day. Thinking of calling it a night. Thank you for correcting me, yes, each hex digit is a nibble (4-bits), two are a byte (8-bits).

                  Little-Endian means lsf bit stored first, right?

                  So I should try something like:

                  10 00 00 00
                  20 00 00 00

                  etc?
                  -- Law of Expanding Memory: Applications Will Also Expand Until RAM Is Full

                  Comment


                    #29
                    Re: Commodore and old system LHA archive format...

                    I would try all zeros first. This will tell us when time begins. Each increment appears to correspond to approximately 1 second.

                    I suspect that time begins at 4:00p on Dec 31,1997.

                    Comment


                      #30
                      Re: Commodore and old system LHA archive format...

                      Originally posted by fzabkar View Post
                      I would try all zeros first. This will tell us when time begins. Each increment appears to correspond to approximately 1 second.

                      I suspect that time begins at 4:00p on Dec 31,1997.
                      Yes, the ar program puts in all 0's and it shows a time of 12-31-97 4:00PM. Why though? Why is the beginning of time Dec 31, 1997 at 4:00PM? Could this maybe be the time the original program was created? I would think time would start in 1980, being an MS-DOS program...
                      -- Law of Expanding Memory: Applications Will Also Expand Until RAM Is Full

                      Comment


                        #31
                        Re: Commodore and old system LHA archive format...

                        If you examine the header.c and header.doc files in the packages uploaded by stj, you find that there are two date/time formats -- generic stamp format and Unix format (1/1/1970 0:00).

                        My DOS tool (LHA255.EXE) uses the former:

                        Code:
                        /*----------------------------------------------------------------------*/
                        /*									*/
                        /*	Generic stamp format:						*/
                        /*									*/
                        /*	 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16		*/
                        /*	|<-------- year ------->|<- month ->|<-- day -->|		*/
                        /*									*/
                        /*	 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0		*/
                        /*	|<--- hour --->|<---- minute --->|<- second*2 ->|		*/
                        /*									*/
                        /*----------------------------------------------------------------------*/
                        Your earlier example used Unix time whereas your current format appears to use a base of 4:00PM on Dec 31,1997, and this increments by 1 second per count. I confess I don't understand.

                        The header.doc and header.c files would suggest that the choice of generic versus Unix time is determined by the "level" byte (byte 0x14). A value of 0x00 or 0x01 selects generic time while a value of 0x02 selects Unix time. There is no mention of any other date/time stamp. In my DOS case and your case the level byte has a value of 0x01, so one would expect that the generic format would be used. Clearly this is not what is happening in your case.

                        Comment


                          #32
                          Re: Commodore and old system LHA archive format...

                          Yeah, agreed. It's odd and I wonder what program was actually used to create this "custom" archive. ar is soo close to creating exact duplicates against the original JetBBS.dat file. When I run JetSetup.exe, it even has the same bugs that's in JetSetup.exe (It extracts 119 files but displays the message 119 successfully extracted and then shows two more files that were extracted after the message (even those though two files make up the 119)).

                          I contacted the original author of ar and he said I can do what I want with the program and that it's the "latest" version that he wrote. He suggested I check out LHA if I wanted something more up to date.

                          I appreciate all the help. I wonder if maybe Troy modified the program to add a time / date stamp and picked seconds since 1997 instead of using a generic or unix time stamp. I don't think seconds are going to be very efficient.

                          We're still missing something though. If all 00's are Dec 31, 1997, how come when I use the original JetBBS.dat file, the JetBBS.exe file has a time stamp of 06-08-96 11:13pm, a date that's actually before Dec 31, 1997 4:00pm...

                          Maybe there's a flag that shows if we count forward or backwards? Some weird going on there.
                          -- Law of Expanding Memory: Applications Will Also Expand Until RAM Is Full

                          Comment


                            #33
                            Re: Commodore and old system LHA archive format...

                            I wish I knew more about assembly for x86 CPUs, DOS executables and using debug to step through the program and figure out what's going on by looking at the assembly.
                            Last edited by Spork Schivago; 02-22-2016, 04:23 PM.
                            -- Law of Expanding Memory: Applications Will Also Expand Until RAM Is Full

                            Comment


                              #34
                              Re: Commodore and old system LHA archive format...

                              Perhaps the program behaves differently when running inside a DOS emulator under Linux? I'm running the LHA255 program in a DOS box under Windows.

                              Comment


                                #35
                                Re: Commodore and old system LHA archive format...

                                I have Oracle's VirtualBox setup with DOS 6.22 now. I'll try the original and see if it produces the same results as DOSEmu under Linux. I know with all 00's, it's the same results in DOS 6.22 running under VirtualBox as it is for DOSEmu.

                                It's a real pain getting the files into VirtualBox though. I first have to copy the files to disc and then create a disk image from the 1.44MB floppy disk. Then I can have VirtualBox mount the image. It seems VirtualBox doesn't work with my USB Floppy drive (probably because there's no USB support for DOS). It doesn't work with my thumb drives and because I cannot install OS Additions, I can't do shared folders. I looked into setting up network shares but that seems to require DOS drivers for my wife's wireless NIC. Those things are hard to find!
                                -- Law of Expanding Memory: Applications Will Also Expand Until RAM Is Full

                                Comment


                                  #36
                                  Re: Commodore and old system LHA archive format...

                                  Why can't you boot from FreeDOS on a USB stick?

                                  Comment


                                    #37
                                    Re: Commodore and old system LHA archive format...

                                    Would it be worth experimenting with the OS ID byte? Instead of Unknown (0x20), try "U" for Unix or "M" for MS-DOS.

                                    Comment


                                      #38
                                      Re: Commodore and old system LHA archive format...

                                      you realise his may have been developed on an atari-ST or an amiga right?

                                      so dont expect it to be just DOS or UNIX date-coding!

                                      Comment


                                        #39
                                        Re: Commodore and old system LHA archive format...

                                        Originally posted by fzabkar View Post
                                        Would it be worth experimenting with the OS ID byte? Instead of Unknown (0x20), try "U" for Unix or "M" for MS-DOS.
                                        I like that idea. I just tried the original JetBBS.dat file on VirtualBox and just like in DOSEmu, the timestamp shows up for JetBBS.exe as: 06-08-96 11:13PM
                                        -- Law of Expanding Memory: Applications Will Also Expand Until RAM Is Full

                                        Comment


                                          #40
                                          Re: Commodore and old system LHA archive format...

                                          Originally posted by stj View Post
                                          you realise his may have been developed on an atari-ST or an amiga right?

                                          so dont expect it to be just DOS or UNIX date-coding!
                                          There's a good chance that Troy got the source code to create these .DAT files using the source code for a program that was originally written for an OS other than DOS.

                                          I remember what gave me the idea that these were modified LHA archives. I scoured the internet looking for all the JetBBS files I could find. Some of the earlier versions used non-modified LHA archives. Linux identifies these older versions as LHa (2.x) archives.

                                          I wonder if there's any older versions of LHA that had a different time format.
                                          -- Law of Expanding Memory: Applications Will Also Expand Until RAM Is Full

                                          Comment

                                          Working...
                                          X