English Amiga Board


Go Back   English Amiga Board > Coders > Coders. General

 
 
Thread Tools
Old 08 February 2014, 05:49   #1
ant512
Registered User
 
Join Date: Dec 2002
Location: California
Posts: 964
Compression of AMOS Pro compiler's "squash" function?

I'm trying to unpack a data file that was originally compressed using the AMOS Pro compiler's "Squash" function. Without using AMOS.

Does anyone have any idea what compression algorithm this used? I was hoping it was PowerPacker but it doesn't look like it.
ant512 is offline  
Old 08 February 2014, 19:59   #2
ant512
Registered User
 
Join Date: Dec 2002
Location: California
Posts: 964
Progress so far! Not much.

The last 4 bytes of the packed file contain the unpacked size. All of the rest of the file is a bitstream, in which the bits are all backwards (so the bits 1000000b represent the hex value 0x01).

Here's an example file. Hex on the left; binary on the right. T final 4 bytes are stripped as I already know what those mean.

Code:
800BC704: 10000000000010111100011100000100
00001010: 00000000000000000001000000010000
800BD714: 10000000000010111111110100010100
The original file contains the character 'A' 64 times.

Here's another:

Code:
800BC684: 10000000000010111100011010000100
00001010: 00000000000000000001000000010000
800BD694: 10000000000010111101011010010100
This contains the character 'B' 64 times.

And another:

Code:
4003C685: 01000000000000111100011010000101
00104848: 00000000000100000100100001001000
40138ECD: 01000000000100111000111011001101
This is a 64 byte file containing the repeated character sequence 'AB'.

...and this:

Code:
C00DC704: 11000000000011011100011100000100
18584018: 00011000010110000100000000011000
D855871C: 11011000010101011000011100011100
This is a 64-byte file containing the repeated sequence 'ABC'.

There are a few interesting things I can see. The first few files obviously have the bit sequence for 'A' and 'B' at the end of the first row. The first byte of each file changes depending on how many different characters the file contains: '10000000' for 1 character, '01000000' for 2 characters, and '11000000' for 3 characters (mirror them and you get 1, 2 and 3 in decimal).

Here's another file:

Code:
900AC701: 10010000000010101100011100000001
41020242: 01000001000000100000001001000010
04058401: 00000100000001011000010000000001
00000010: 00000000000000000000000000010000
D50D4152: 11010101000011010100000101010010
This contains the repeated sequence 'AAABBBCCC'. The first byte is 0x09, which suggests that it is tracking sequence length rather than the number of distinct characters.

Here's another packed file:

Code:
D802C6B5
05048584
4544C5C4
2524A5A4
6564E5E4
15149594
5554D5D4
3534B591
00000007
AD763363
00000051
This one includes the final 4 bytes. This is the original file:

Code:
AABCDEFGHIJKLMNOPQRSTUVWXYZAABCDEFGHIJKLMNOPQRSTUVWXYZAABCDEFGHIJKLMNOPQRSTUVWXYZ
...so it looks like the first byte is the sequence length (the sequence is 27 characters, and that's what the first byte stores).

Last edited by ant512; 08 February 2014 at 20:12.
ant512 is offline  
Old 09 February 2014, 00:04   #3
Lonewolf10
AMOS Extensions Developer
 
Lonewolf10's Avatar
 
Join Date: Jun 2007
Location: near Cambridge, UK
Age: 44
Posts: 1,924
Quote:
Originally Posted by ant512 View Post
I'm trying to unpack a data file that was originally compressed using the AMOS Pro compiler's "Squash" function. Without using AMOS.
You might be at it for a while if you don't use AMOS, for 2 reasons:

1) I believe the Squash function in the compiler was buggy

2) The source to AMOS 1.3 and AMOS Pro are currently available on the internet. Some of us (mainly bruceuncle right now) over at the AMOS Factory are working on fixing and improving AMOS Pro.
Lonewolf10 is offline  
Old 09 February 2014, 01:18   #4
ant512
Registered User
 
Join Date: Dec 2002
Location: California
Posts: 964
Quote:
Originally Posted by Lonewolf10 View Post
You might be at it for a while if you don't use AMOS, for 2 reasons:

1) I believe the Squash function in the compiler was buggy

2) The source to AMOS 1.3 and AMOS Pro are currently available on the internet. Some of us (mainly bruceuncle right now) over at the AMOS Factory are working on fixing and improving AMOS Pro.
I think the Squash function and the compiler squash are different. I've got the source now and am sloooowly adding comments and trying to figure out how it works.

Anyone want to help figuring out the assembly?
ant512 is offline  
Old 10 February 2014, 22:45   #5
Lonewolf10
AMOS Extensions Developer
 
Lonewolf10's Avatar
 
Join Date: Jun 2007
Location: near Cambridge, UK
Age: 44
Posts: 1,924
Quote:
Originally Posted by ant512 View Post
I think the Squash function and the compiler squash are different. I've got the source now and am sloooowly adding comments and trying to figure out how it works.
Hmm, 2 different squash's... I didn't know that.


Quote:
Originally Posted by ant512 View Post
Anyone want to help figuring out the assembly?
Errr... maybe. I already downloaded the AMOS sources last year and might take a look tomorrow. I can't promise anything as work is busy at times and I might forget.

PS. Bruceuncle has documented a fair chunk of AMOS Pro. Primarily the start-up sequence, variable storage locations and the like. The information may be helpful to you.
Lonewolf10 is offline  
Old 11 February 2014, 08:04   #6
ant512
Registered User
 
Join Date: Dec 2002
Location: California
Posts: 964
Quote:
Originally Posted by Lonewolf10 View Post
Errr... maybe. I already downloaded the AMOS sources last year and might take a look tomorrow. I can't promise anything as work is busy at times and I might forget.
That would be extremely helpful! My attempt went like this:

Ok, get a pointer to the file size.
Hmm, what does that addressing mode do? Oh, ok; moving the pointer back.
Now why are we getting those two long words?
XOR? Why are we XORing things?
Er, move d0 into d5.
Now we're right-shifting d5. What's in d5?
BNE? Which CCR flag does that check?
What's happing now?

After an attempt at following the flow in Devpac I'm now decoding everything in AMOS, ready for loading up with another language on another platform. It's far from ideal.
ant512 is offline  
 


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Similar Threads
Thread Thread Starter Forum Replies Last Post
Competition Pro recognized as "USB 2A4K GamePad" mainzelM support.FS-UAE 4 02 June 2022 21:58
Problem with AMOS Pro compiler install amigapd support.WinUAE 2 16 December 2011 15:59
Capitan Zbik, "new" polish text adventure game in Amos s2325 Retrogaming General Discussion 1 04 April 2009 22:13
"Search" function on EAB forum. fc.studio project.EAB 8 18 October 2008 15:44
AMOS professional "Wonderland" game dionisis request.Apps 2 15 July 2007 08:10

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 22:02.

Top

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Page generated in 0.17046 seconds with 15 queries