11.07.2015 Views

Untitled - TRS-80 Color Computer Archive

Untitled - TRS-80 Color Computer Archive

Untitled - TRS-80 Color Computer Archive

SHOW MORE
SHOW LESS
  • No tags were found...

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

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

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!