--- title: "Mike’s Notebook: CMPRES" type: "article" slug: "mikes-notebook-18" url: "http://localhost/article/mikes-notebook-18/" markdown_url: "http://localhost/article/mikes-notebook-18.md" published_at: "2022-10-07T12:25:00+00:00" modified_at: "2026-08-16T10:28:21+00:00" featured_image: url: "http://localhost/wp-content/uploads/2022/04/20230809-041332.jpg" excerpt: "If you are used to SAVEing SCREEN$ files, you may have noticed that the file size is rather large especially if you LOAD or SAVE using cassette storage medium. The file is 6912 bytes long. Another problem to overcome is that if you want to store morethan four or five SCREEN$'s in RAM memory, there…" category: - name: "The Plotter" slug: "the-plotter" taxonomy: "category" url: "http://localhost/category/periodicals/the-plotter/" post_tag: - name: "Best of Timex/Sinclair 2068 Articles and Documents" slug: "ts2068best" taxonomy: "post_tag" url: "http://localhost/tag/ts2068best/" - name: "TS 2068" slug: "ts2068" taxonomy: "post_tag" url: "http://localhost/tag/ts2068/" - name: "Type-in program" slug: "type-in-program" taxonomy: "post_tag" url: "http://localhost/tag/type-in-program/" basic: - name: "SCREEN$" slug: "screen" taxonomy: "basic" url: "http://localhost/basic/screen/" model: - name: "Timex/Sinclair 2068" slug: "ts-2068" taxonomy: "model" url: "http://localhost/model/ts-2068/" indiv: - name: "Michael DiRienzo" slug: "michael-dirienzo" taxonomy: "indiv" url: "http://localhost/indiv/michael-dirienzo/" publication_r: id: 21216 title: "The Plotter" type: "periodical" url: "http://localhost/periodical/the-plotter/" authors: "Michael DiRienzo" authors_r: - name: "Michael DiRienzo" slug: "michael-dirienzo" taxonomy: "indiv" url: "http://localhost/indiv/michael-dirienzo/" volume: "9" issue: "2" issues_articles: - id: 39480 title: "The Plotter v9 n2" type: "issue" url: "http://localhost/issue/the-plotter-v9-n2/" pages: "4-5" pubdate: "February 1991" archive_link: false --- # Mike’s Notebook: CMPRES If you are used to SAVEing SCREEN$ files, you may have noticed that the file size is rather large especially if you LOAD or SAVE using cassette storage medium. The file is 6912 bytes long. Another problem to overcome is that if you want to store morethan four or five SCREEN$’s in RAM memory, there is hardly any memory left for your programs. This month’s utility will COMPRESS a typical SCREEN$ file up to as much as 1/2 its usual size. In addition, a header is automatically included in the SAVED file which will resolve the compressed SCREEN$ back to its full size onto the screen by simply using RANDOMIZE USR (address). The program will SAVE the compressed SCREEN$ CODE at address 40246 and you will be shown the file length if you wish to write it down. When you are ready to LOAD the compressed file into your own program, you can LOAD it to any legal address then “call” that address to get your expanded SCREEN$. The program will POKE in the CODE then prompt you to INPUT the filename of the SCREEN$ that you want to compress. It will then LOAD it and temporarily store it. Next you’ll be asked what name you want to give the compressed SCREEN$. The SCREEN$ will be instantly compressed and you will be notified of the start address and byte length of the file. Now, a prompt to press any key when you are ready to SAVE your file. Don’t worry, your compressed file is already stored at address 40246. This utility can be easily modified by you to work with any disk system. I use this utility a lot to animate as many as 15 compressed SCREEN$ by LOADing them consecutively in memory then calling them in sequence to simulate animation. The CODE is not relocatable and is 132 bytes long. ## Source Code ``` 10 CLEAR 36611: LET store=36720: LET recall=36732: LET compress=36612: GO SUB 100 20 INPUT "What is the file name to LOAD? ";n$ 30 LOAD n$SCREEN$ : RANDOMIZE USR store 40 INPUT "What is the file name to SAVE? ";n$: RANDOMIZE USR recall 50 RANDOMIZE USR compress: LET L=USR 40192: LET L=L-40246 60 PRINT INK 2; PAPER 5;AT 10,0;"File:""";n$;"""CODE 40246,";L; FLASH 1;AT 11,5;"Press any key to SAVE": PAUSE 0 70 SAVE n$CODE 40246,L 80 CLS : RANDOMIZE USR 40246: PRINT INK 1; FLASH 1;AT 10,0;"To resolve the compressed file back to the screen in the future RANDOMIZE USR (Start address where CODE is LOADed!)" 90 STOP 100 LET t=0 110 FOR N=36612 TO 36743 120 READ a: POKE n,a: LET t=t+a 130 NEXT n: IF t<>12070 THEN PRINT FLASH 1;"Data Error! Recheck DATA line.": STOP 140 RETURN 150 DATA 17,0,157,33,16,143,1,98,0,237,176,201,197,209,33,100,0,25,235,33,0,64,14,1,126,167,40,9,254,255,40,5,237,160,3,24,21,71,121,60,35,40,7,126,184,32,3,12,24,243,120,18,19,121,18,19,14,1,124,254,91,32,217,213,193,201,17,0,64,221,33,46,0,221,9,122,254,91,200,221,126,0,167,40,10,254,255,40,6,18,19,221,35,24,236,221,70,1,18,19,16,252,221,35,221,35,24,223 160 DATA 17,0,157,33,0,64,1,0,24,237,176,201,17,0,64,33,0,157,1,0,24,237,176,201 ```