Lines 100-5000 are reservedfor your program. In this demonstration, line 110 simply delayslong enough for you to look at thescreen. In a real program, of course,you would substitute your owncode. Just remember that your portion of the program should use onlyline numbers 100-5000.Instead of terminating withEND, your program should fallthrough to lines 5010-5030. Theselines restore the usual ST BASICmenu titles, clear the output window, and reopen it so that you canuse BASIC normally. Since theshell code draws on the entirescreen, it erases the ST BASICmenu titles. (However, the menusare still active while the programruns, so that you can select Break tostop the program, and so on.) Thus,it's necessary to redraw the menutitles when the program ends. Thestring nameS in line 5010 containsthe text for these titles, which youcan change if you wish. The ENDstatement at the end of line 5030terminates the program.MergingUnless you write your programswith this shell in mind, most programs will need some modificationbefore you merge them with theshell. This is necessary in order topreserve the windowless screen.Once you have cleared the screencompletely, you cannot use ordinary BASIC graphics commandssuch as PCIRCLE, GOTOXY, LINEF,and CIRCLE. If you do, ST BASICsuddenly redraws the right andlower bars of the output window,even though these commands havenothing specifically to do withthosewindow bars.To avoid such unwanted effects, you must create all graphicswith VDISYS commands whicharen't tied to windows. This rulealso includes text, which must beplaced with VDISYS instead ofPRINT. VDISYS commands aremore complicated to use than mostBASIC commands, but they can operate much faster, giving your program the appearance of somethingwritten in machine language. Anygraphics or text that you create inST BASIC can also be created withVDISYS commands. In fact, BASICitself uses VDI routines to creategraphics in the first place.The simplest way to use theshell program is to delete existinglines 100-110 and MERGE it withyour own program code. Here arethe steps to follow before you attempt the merge: First, renumberyour program if necessary, so thatits line numbers fall in the range100-5000. Then substitute thename of your program in the stringtitle$ in line 5090. Delete anyCLEARW 2 or FULLW 2 commandsfrom the beginning of your program and rename any variables thatconflict with the variable namesused in the shell code. Once this isdone, you can perform the merge.ProgramNotesLines 50-70 set several importantvariables used by subroutines in theshell. The variables dcx and dcy represent the screen size, and the variables c and s indicate colors.The PRGNAME subroutine beginning at line 5050 specifies thescreen coordinates and color according to the current resolutionand passes those values to theRECT subroutine. Lines 5100-5120draw the top menu bar in the colorspecified by the variable s.Lines 5130-5160 call a VDIroutine which places text at the designated screen coordinates. Line5150 centers the text on the screen.Line 5160 places the text 8 linesbelow the top border in low- andmedium-resolution modes or 16lines down in high-resolutionmode. Lines 5170-5190 POKE thenecessary information into memoryprior to the VDISYS call. You canplace the title lower on the screenby changing lines 5100 and 5160.You may want to include additionalVDISYS calls to enlarge the lettering or create special text effects. Oryou can eliminate the title altogether by deleting lines 5090-5190.The RECT subroutine calls aVDI routine which fills the specified screen rectangle with the designated color and pattern.The MENU subroutine is similar to the PRGNAME routine, butit's designed to dear the screen backto white, the usual background color(5300). The LEN function used inline 5150 is omitted in lines 5330and 5360 because the number ofcharacters in the string name$ (ineluding spaces) is now known to be28. If you change the length ofname$, change the 27 in line 5360 tomatch the new length.Full-Screen Shell ForST BASIC30 ' FULL SCREEN SHELL PRDGRAM40 ps=peek(systab)50 if ps=l then dcx=639:dcy=399:c=l:s=l60 i-f ps=2 then dcx=639idcy=199:c=2:s=370 i-f ps=4 then dc>:=319: dcy=199:c=4is=12<strong>80</strong> gosub PRGNAME90100 'YOUR PROGRAM STARTS HERE110 -for j = l to 5000:next j '5000 "delay loop -for demonstration5010 name*="Desk File Run EditDebug"5020 gosub MENU5030 clearw 2:-fullw 2a end5040 '5050 PRGNAME:5060 x1=0:yl=0:x2=dcx:y2=dcy5070 color 2,c,c,1,450<strong>80</strong> gosub RECT5090 title*="FuU Screen Shell5100 xl=0:yl=0:>:2=dcx:y2=Cdcy/20)5110 color 6,s,s,2,25120 gosub RECT5130 poke contr1,8:poke contrl+2,15140 poke contrl+6,l&n(titlet)5150 poke ptsin, (dcx—1en:return @52 COMPUTE February 1987
FileCompressorChrisRogersThis Commodore 64 utility crunchesBASIC programs and other files sothat they occupy less room on a disk.Since smaller files load faster, compressed files can also transfer to andfrom disk faster than usual. A diskdrive is required.Using a clever programming technique, "File Compressor" makes itpossible to squeeze disk files into asmaller space than usual, whichconserves disk space and speeds upthe transfer of data between thecomputer and the disk drive. Onceyou have installed File Compressor,it can automatically compressBASIC programs during any SAVEand decode compressed programsinto normal form during a LOAD.You can also compress other datasuch as hi-res graphics screens.Typing File CompressorType in the program and save acopy. Because File Compressor iswritten in machine language, youmust enter it with the "MLX" machine language entry program listed elsewhere in this issue. Be sureto read the MLX article carefullybefore you attempt to use it. Whenyou run MLX, you'll be asked for astarting address and an ending address for the data you'll be entering.Here are the correct addresses:Starting address: C200Ending address: C617After you save File Compressor, you can load it with the command LOAD "COMPRESSOR",8,1(replace COMPRESSOR with thefilename you used when saving theprogram). After the program loads,type NEW and press RETURN toreset important BASIC pointers.Compressing BASICFile Compressor can be used twodifferent ways. The first method al-lows you to save and load a BASICprogram in compressed form. Toinstall File Compressor, load it intomemory; then type SYS 50600 andpress RETURN. To save a BASICprogram in compressed form, typeSAVE and press RETURN. Whenthe computer prompts you to entera filename, enter the desired nameand press RETURN again. The program is saved to disk in compressedformat. To load a compressedBASIC program, type LOAD andpress RETURN; then enter the desired filename at the prompt.To save or load BASIC programs in normal form, supply afilename with the LOAD or SAVEcommand. For instance, SAVE"TEST",8,1 saves the programTEST to disk as usual. Because itintercepts LOAD and SAVE commands that don't include a filename, File Compressor doesn'tsave compressed files to tape. However, you can still save and loadwith tape in uncompressed form byincluding a filename and adding,1,1 to the command. For instance,SAVE "TEST", 1,1 saves the program TEST to tape as a normalprogramfile.(Don't confuse File Compressor's crunching with normal program storage. You may have heardthat the computer automaticallycrunches BASIC program lines.When you type in a line, the computer stores the line number in onlytwo bytes and replaces every keyword with a one-byte symbol calleda token. This process, usually calledtokenization, reduces the size of theprogram significantly, since manyBASIC keywords are four or fivecharacters long. File Compressorbegins with the already-tokenizedBASIC program and crunches iteven further.)Compressing DataFile Compressor also lets you"crunch" and save the contents ofany memory area, which may include a hi-res graphics screen,sprite shapes, or any other sort ofdata. Of course, it also allows you toreload the data in uncompressedform. This routine demonstrateshow to save a memory area:10000 REM COMPRESSED SAVE SA=START OF SAVE: EA=END OF SAVE: FLS=FILENAME10002 POKE 6<strong>80</strong>,SA/256:POKE 679,SA-PEEK{6<strong>80</strong>)*25610004 POKE 682,EA/256:POKE 681,EA-PEEK(682)*25610006 FLS=FL?+",P,W"+CHR$(0):FOR 1=1 TO LEN(FL$)10008 POKE 831+1,ASC(MID$(FL$,I,1)+CHRS(0)):NEXT10010 SYS 50689:RETURNBefore it calls File Compressorwith SYS, the routine POKEs thestarring and ending addresses ofthe desired memory area into locations 679-6<strong>80</strong> and 681-682, respectively. You must also store theASCII characters for the disk filename in the zone beginning at location 832. Note that the filenamemust include the extension ,P,Wand end with a zero byte. This routine shows how to load a compressed file back into memory:10012 REM COMPRESSED LOAD SA=START OF LOAD: FLS=FILENAME10014 POKE 6<strong>80</strong>,SA/256:POKE 679,SA-PEEK(6<strong>80</strong>)*25610016 FL$=FLS+",P,R"+CHRS(0):FOR 1=1 TO LEN(FLS)10018 POKE 831+1,ASC(MIDS(FL$,I,1)+CHRS(0)):NEXT10020 SYS 50666:RETURNThis procedure is similar to theprevious routine. However, youneed only specify a beginning address for the load, and the filenameshould end with ,P,R. When thatpreparation is complete, SYS 50666calls File Compressor to decode thefile data and put it back in memory.Less Is MoreYou can use File Compressor without knowing how it works. However, you may be interested in aFebruary 1987 COMPUTE) 53
- Page 2 and 3:
We just did something only the best
- Page 4 and 5: icate Maker!Because accomplishments
- Page 6 and 7: Editor'sNotesThis is the 81st issue
- Page 8 and 9: PublisherFounder/Editor in ChlelSen
- Page 10 and 11: Selby BatemanFeatures Editor....
- Page 12 and 13: , ■■-■■'■ ;-.-..■■■
- Page 14 and 15: The new Compaq Deskpro 386 is among
- Page 16 and 17: Selby Bateman, Features Editoricrop
- Page 18 and 19: 68030 chip, which should be readyfo
- Page 20 and 21: computer are often called proprieta
- Page 22 and 23: Tom R. Halfhill, Staff Editorore By
- Page 24 and 25: Selby Bateman, Features Editorasers
- Page 26 and 27: MicroscopeSheldonLeemonThe new Appl
- Page 29 and 30: Fly to Florida!Scenery Disk # 7 cov
- Page 31 and 32: contains twice as many vertical pix
- Page 33 and 34: And you don't even have toleave you
- Page 35 and 36: Increase your knowledge about all a
- Page 37 and 38: BEST SERVICE IN THE USA • ONEDAY
- Page 39 and 40: BATTERIES Sg? INCLUDEDTHE FOUR LETT
- Page 41 and 42: LYCOCOMPUTERMARKETING & CONSULTANTS
- Page 43 and 44: ATARIJKLYCOCOMPUTERMARKETING & CONS
- Page 45 and 46: QuickProDOSCatalog For AppleLarrySh
- Page 47 and 48: Behaved Batch FilesCOPY CON: YESNO.
- Page 49 and 50: ASC II ExpressBalance of PowerBally
- Page 51 and 52: END**Beap:*SOUND 800,1,100,0:SOUND
- Page 53: COMMODOREAPPLEC64 COMPUTER C-128COM
- Page 57 and 58: character n. Whenever File Compress
- Page 59 and 60: \Make Your ChoiceC-64 or C-128BASIC
- Page 61 and 62: RP0A71i4C0A79:1B0A81:0A0A89:1F0A91i
- Page 63 and 64: ACCOLADEHardball 24.95Mean 18 31.95
- Page 65 and 66: Ibefore a move is made. Each compar
- Page 67 and 68: PH 1390 IF P$="C" AND T0>=7 THEN .1
- Page 69 and 70: 5D 2310 DATA 30,34,34,30,2,2,2,0FE
- Page 71 and 72: I10 630 P$="C"BC 640 REM tt PICK BE
- Page 73 and 74: ,——■———U-J>G>Player■p
- Page 75 and 76: INSIGHT:AtariBillWilkinsonNumber-Ba
- Page 77 and 78: EMPX,TEMPY,MASKBH 9140 TEMPX-X1TEMP
- Page 79 and 80: AmigaViewSheldonLeemonThe Latest Am
- Page 81 and 82: Computers and SocietyDavid D. Thorn
- Page 83 and 84: RUSH POSTAGE-PAID CARDFOR YOUR FREE
- Page 85 and 86: Train with NRI for a high payingcar
- Page 87 and 88: PersonalComputingDonald B. irivette
- Page 89 and 90: 3M DiskettesICEI has an outstanding
- Page 91 and 92: key (Atari logo key on 400/800 mode
- Page 93 and 94: MLXMachine Language Entry ProgramFo
- Page 95 and 96: THEN PRINT IN?iPRINTM{UP][5 RIGHT}"
- Page 97 and 98: When you want to talk price.AmdekMO
- Page 99 and 100: THE LOWESTTHE BESTPRICESSERVICEELEC
- Page 101 and 102: fNOWAVAILABLE AT24$O>!00The Mew Car
- Page 103 and 104: COMPUTERSFREE Reader Information Se
- Page 105 and 106:
STARGLIDERJJtarglider — is an all