Home » Archimedes archive » Archimedes World » AW-1996-03-Disc 2.adf » !AcornAns_AcornAns » November/Squash/UnSquash
November/Squash/UnSquash
This website contains an archive of files for the Acorn Electron, BBC Micro, Acorn Archimedes, Commodore 16 and Commodore 64 computers, which Dominic Ford has rescued from his private collection of floppy disks and cassettes.
Some of these files were originally commercial releases in the 1980s and 1990s, but they are now widely available online. I assume that copyright over them is no longer being asserted. If you own the copyright and would like files to be removed, please contact me.
Tape/disk: | Home » Archimedes archive » Archimedes World » AW-1996-03-Disc 2.adf » !AcornAns_AcornAns |
Filename: | November/Squash/UnSquash |
Read OK: | ✔ |
File size: | 056E bytes |
Load address: | 0000 |
Exec address: | 0000 |
File contents
10REM >UnSquash 20file$ = "SampleX" 30PROCload_source_data 40PROCdecompress_data 50VDU 14 60PROCdisplay_stats 70PROCdisplay_decompressed_data 80VDU 15 90END 100: 110: 120DEF PROCdecompress_data 130SYS "Squash_Decompress", %1000, -1 TO workspacesize% 140DIM decomp% decompsize%+1, work% workspacesize% 150: 160REM Now we decompress the data! 170SYS "Squash_Decompress", %100, work%, data%+20, datasize%-20, decomp%, decompsize% TO status%,,,, endoutput% 180IF status%<>0 ERROR 0, "One step decompression failed, status "+STR$status% 190IF endoutput%-decomp%<>decompsize% ERROR 0, "Decompressed data size not as expected" 200ENDPROC 210: 220DEF PROCdisplay_stats 230PRINT "[Press shift to scroll through text below]" 240PRINT 250PRINT "Source file size: ", datasize% 260PRINT "Decompression workspace size:", workspacesize% 270PRINT "Decompressed file size: ", decompsize% 280PRINT 290ENDPROC 300: 310DEF PROCdisplay_decompressed_data 320PRINT "The decompressed data, treated as a text file, reads as follows" 330PRINT STRING$(76, "*") 340decomp%?decompsize% = 0 350SYS "OS_PrettyPrint", decomp%, 0, 0 360PRINT STRING$(76, "*") 370ENDPROC 380: 390DEF PROCload_source_data 400LOCAL type%, id$ 410SYS "OS_File", 5, file$ TO objtype%,,,, datasize% 420IF objtype%<>1 ERROR 0, "File '"+file$+"' does not exist" 430DIM data% datasize% 440SYS "OS_File", 255, file$, data%, 0 450id$ = CHR$(data%?0)+CHR$(data%?1)+CHR$(data%?2)+CHR$(data%?3) 460IF id$<>"SQSH" ERROR 0, "Squash file format not recognised" 470decompsize% = data%!4 480ENDPROC
� >UnSquash file$ = "SampleX" �load_source_data (�decompress_data 2� 14 <�display_stats F�display_decompressed_data P� 15 Z� d: n: x� �decompress_data �6ș "Squash_Decompress", %1000, -1 � workspacesize% �1� decomp% decompsize%+1, work% workspacesize% �: �!� Now we decompress the data! �nș "Squash_Decompress", %100, work%, data%+20, datasize%-20, decomp%, decompsize% � status%,,,, endoutput% �G� status%<>0 � 0, "One step decompression failed, status "+�status% �S� endoutput%-decomp%<>decompsize% � 0, "Decompressed data size not as expected" �� �: �� �display_stats �2� "[Press shift to scroll through text below]" �� �0� "Source file size: ", datasize% 5� "Decompression workspace size:", workspacesize% 2� "Decompressed file size: ", decompsize% � "� ,: 6 � �display_decompressed_data @G� "The decompressed data, treated as a text file, reads as follows" J� �76, "*") Tdecomp%?decompsize% = 0 ^&ș "OS_PrettyPrint", decomp%, 0, 0 h� �76, "*") r� |: �� �load_source_data �� type%, id$ �3ș "OS_File", 5, file$ � objtype%,,,, datasize% �8� objtype%<>1 � 0, "File '"+file$+"' does not exist" �� data% datasize% �&ș "OS_File", 255, file$, data%, 0 �5id$ = �(data%?0)+�(data%?1)+�(data%?2)+�(data%?3) �:� id$<>"SQSH" � 0, "Squash file format not recognised" �decompsize% = data%!4 �� �
00000000 0d 00 0a 0f f4 20 3e 55 6e 53 71 75 61 73 68 0d |..... >UnSquash.| 00000010 00 14 15 66 69 6c 65 24 20 3d 20 22 53 61 6d 70 |...file$ = "Samp| 00000020 6c 65 58 22 0d 00 1e 15 f2 6c 6f 61 64 5f 73 6f |leX".....load_so| 00000030 75 72 63 65 5f 64 61 74 61 0d 00 28 14 f2 64 65 |urce_data..(..de| 00000040 63 6f 6d 70 72 65 73 73 5f 64 61 74 61 0d 00 32 |compress_data..2| 00000050 08 ef 20 31 34 0d 00 3c 12 f2 64 69 73 70 6c 61 |.. 14..<..displa| 00000060 79 5f 73 74 61 74 73 0d 00 46 1e f2 64 69 73 70 |y_stats..F..disp| 00000070 6c 61 79 5f 64 65 63 6f 6d 70 72 65 73 73 65 64 |lay_decompressed| 00000080 5f 64 61 74 61 0d 00 50 08 ef 20 31 35 0d 00 5a |_data..P.. 15..Z| 00000090 05 e0 0d 00 64 05 3a 0d 00 6e 05 3a 0d 00 78 16 |....d.:..n.:..x.| 000000a0 dd 20 f2 64 65 63 6f 6d 70 72 65 73 73 5f 64 61 |. .decompress_da| 000000b0 74 61 0d 00 82 36 c8 99 20 22 53 71 75 61 73 68 |ta...6.. "Squash| 000000c0 5f 44 65 63 6f 6d 70 72 65 73 73 22 2c 20 25 31 |_Decompress", %1| 000000d0 30 30 30 2c 20 2d 31 20 b8 20 77 6f 72 6b 73 70 |000, -1 . worksp| 000000e0 61 63 65 73 69 7a 65 25 0d 00 8c 31 de 20 64 65 |acesize%...1. de| 000000f0 63 6f 6d 70 25 20 64 65 63 6f 6d 70 73 69 7a 65 |comp% decompsize| 00000100 25 2b 31 2c 20 77 6f 72 6b 25 20 77 6f 72 6b 73 |%+1, work% works| 00000110 70 61 63 65 73 69 7a 65 25 0d 00 96 05 3a 0d 00 |pacesize%....:..| 00000120 a0 21 f4 20 4e 6f 77 20 77 65 20 64 65 63 6f 6d |.!. Now we decom| 00000130 70 72 65 73 73 20 74 68 65 20 64 61 74 61 21 0d |press the data!.| 00000140 00 aa 6e c8 99 20 22 53 71 75 61 73 68 5f 44 65 |..n.. "Squash_De| 00000150 63 6f 6d 70 72 65 73 73 22 2c 20 25 31 30 30 2c |compress", %100,| 00000160 20 77 6f 72 6b 25 2c 20 64 61 74 61 25 2b 32 30 | work%, data%+20| 00000170 2c 20 64 61 74 61 73 69 7a 65 25 2d 32 30 2c 20 |, datasize%-20, | 00000180 64 65 63 6f 6d 70 25 2c 20 64 65 63 6f 6d 70 73 |decomp%, decomps| 00000190 69 7a 65 25 20 b8 20 73 74 61 74 75 73 25 2c 2c |ize% . status%,,| 000001a0 2c 2c 20 65 6e 64 6f 75 74 70 75 74 25 0d 00 b4 |,, endoutput%...| 000001b0 47 e7 20 73 74 61 74 75 73 25 3c 3e 30 20 85 20 |G. status%<>0 . | 000001c0 30 2c 20 22 4f 6e 65 20 73 74 65 70 20 64 65 63 |0, "One step dec| 000001d0 6f 6d 70 72 65 73 73 69 6f 6e 20 66 61 69 6c 65 |ompression faile| 000001e0 64 2c 20 73 74 61 74 75 73 20 22 2b c3 73 74 61 |d, status "+.sta| 000001f0 74 75 73 25 0d 00 be 53 e7 20 65 6e 64 6f 75 74 |tus%...S. endout| 00000200 70 75 74 25 2d 64 65 63 6f 6d 70 25 3c 3e 64 65 |put%-decomp%<>de| 00000210 63 6f 6d 70 73 69 7a 65 25 20 85 20 30 2c 20 22 |compsize% . 0, "| 00000220 44 65 63 6f 6d 70 72 65 73 73 65 64 20 64 61 74 |Decompressed dat| 00000230 61 20 73 69 7a 65 20 6e 6f 74 20 61 73 20 65 78 |a size not as ex| 00000240 70 65 63 74 65 64 22 0d 00 c8 05 e1 0d 00 d2 05 |pected".........| 00000250 3a 0d 00 dc 14 dd 20 f2 64 69 73 70 6c 61 79 5f |:..... .display_| 00000260 73 74 61 74 73 0d 00 e6 32 f1 20 22 5b 50 72 65 |stats...2. "[Pre| 00000270 73 73 20 73 68 69 66 74 20 74 6f 20 73 63 72 6f |ss shift to scro| 00000280 6c 6c 20 74 68 72 6f 75 67 68 20 74 65 78 74 20 |ll through text | 00000290 62 65 6c 6f 77 5d 22 0d 00 f0 05 f1 0d 00 fa 30 |below]"........0| 000002a0 f1 20 22 53 6f 75 72 63 65 20 66 69 6c 65 20 73 |. "Source file s| 000002b0 69 7a 65 3a 20 20 20 20 20 20 20 20 20 20 20 20 |ize: | 000002c0 22 2c 20 64 61 74 61 73 69 7a 65 25 0d 01 04 35 |", datasize%...5| 000002d0 f1 20 22 44 65 63 6f 6d 70 72 65 73 73 69 6f 6e |. "Decompression| 000002e0 20 77 6f 72 6b 73 70 61 63 65 20 73 69 7a 65 3a | workspace size:| 000002f0 22 2c 20 77 6f 72 6b 73 70 61 63 65 73 69 7a 65 |", workspacesize| 00000300 25 0d 01 0e 32 f1 20 22 44 65 63 6f 6d 70 72 65 |%...2. "Decompre| 00000310 73 73 65 64 20 66 69 6c 65 20 73 69 7a 65 3a 20 |ssed file size: | 00000320 20 20 20 20 20 22 2c 20 64 65 63 6f 6d 70 73 69 | ", decompsi| 00000330 7a 65 25 0d 01 18 05 f1 0d 01 22 05 e1 0d 01 2c |ze%......."....,| 00000340 05 3a 0d 01 36 20 dd 20 f2 64 69 73 70 6c 61 79 |.:..6 . .display| 00000350 5f 64 65 63 6f 6d 70 72 65 73 73 65 64 5f 64 61 |_decompressed_da| 00000360 74 61 0d 01 40 47 f1 20 22 54 68 65 20 64 65 63 |ta..@G. "The dec| 00000370 6f 6d 70 72 65 73 73 65 64 20 64 61 74 61 2c 20 |ompressed data, | 00000380 74 72 65 61 74 65 64 20 61 73 20 61 20 74 65 78 |treated as a tex| 00000390 74 20 66 69 6c 65 2c 20 72 65 61 64 73 20 61 73 |t file, reads as| 000003a0 20 66 6f 6c 6c 6f 77 73 22 0d 01 4a 0f f1 20 c4 | follows"..J.. .| 000003b0 37 36 2c 20 22 2a 22 29 0d 01 54 1b 64 65 63 6f |76, "*")..T.deco| 000003c0 6d 70 25 3f 64 65 63 6f 6d 70 73 69 7a 65 25 20 |mp%?decompsize% | 000003d0 3d 20 30 0d 01 5e 26 c8 99 20 22 4f 53 5f 50 72 |= 0..^&.. "OS_Pr| 000003e0 65 74 74 79 50 72 69 6e 74 22 2c 20 64 65 63 6f |ettyPrint", deco| 000003f0 6d 70 25 2c 20 30 2c 20 30 0d 01 68 0f f1 20 c4 |mp%, 0, 0..h.. .| 00000400 37 36 2c 20 22 2a 22 29 0d 01 72 05 e1 0d 01 7c |76, "*")..r....|| 00000410 05 3a 0d 01 86 17 dd 20 f2 6c 6f 61 64 5f 73 6f |.:..... .load_so| 00000420 75 72 63 65 5f 64 61 74 61 0d 01 90 10 ea 20 74 |urce_data..... t| 00000430 79 70 65 25 2c 20 69 64 24 0d 01 9a 33 c8 99 20 |ype%, id$...3.. | 00000440 22 4f 53 5f 46 69 6c 65 22 2c 20 35 2c 20 66 69 |"OS_File", 5, fi| 00000450 6c 65 24 20 b8 20 6f 62 6a 74 79 70 65 25 2c 2c |le$ . objtype%,,| 00000460 2c 2c 20 64 61 74 61 73 69 7a 65 25 0d 01 a4 38 |,, datasize%...8| 00000470 e7 20 6f 62 6a 74 79 70 65 25 3c 3e 31 20 85 20 |. objtype%<>1 . | 00000480 30 2c 20 22 46 69 6c 65 20 27 22 2b 66 69 6c 65 |0, "File '"+file| 00000490 24 2b 22 27 20 64 6f 65 73 20 6e 6f 74 20 65 78 |$+"' does not ex| 000004a0 69 73 74 22 0d 01 ae 15 de 20 64 61 74 61 25 20 |ist"..... data% | 000004b0 64 61 74 61 73 69 7a 65 25 0d 01 b8 26 c8 99 20 |datasize%...&.. | 000004c0 22 4f 53 5f 46 69 6c 65 22 2c 20 32 35 35 2c 20 |"OS_File", 255, | 000004d0 66 69 6c 65 24 2c 20 64 61 74 61 25 2c 20 30 0d |file$, data%, 0.| 000004e0 01 c2 35 69 64 24 20 3d 20 bd 28 64 61 74 61 25 |..5id$ = .(data%| 000004f0 3f 30 29 2b bd 28 64 61 74 61 25 3f 31 29 2b bd |?0)+.(data%?1)+.| 00000500 28 64 61 74 61 25 3f 32 29 2b bd 28 64 61 74 61 |(data%?2)+.(data| 00000510 25 3f 33 29 0d 01 cc 3a e7 20 69 64 24 3c 3e 22 |%?3)...:. id$<>"| 00000520 53 51 53 48 22 20 85 20 30 2c 20 22 53 71 75 61 |SQSH" . 0, "Squa| 00000530 73 68 20 66 69 6c 65 20 66 6f 72 6d 61 74 20 6e |sh file format n| 00000540 6f 74 20 72 65 63 6f 67 6e 69 73 65 64 22 0d 01 |ot recognised"..| 00000550 d6 19 64 65 63 6f 6d 70 73 69 7a 65 25 20 3d 20 |..decompsize% = | 00000560 64 61 74 61 25 21 34 0d 01 e0 05 e1 0d ff |data%!4.......| 0000056e