--- title: "TS 2068 Basic Tutor" type: "article" slug: "ts-2068-basic-tutor" url: "http://localhost/article/ts-2068-basic-tutor/" markdown_url: "http://localhost/article/ts-2068-basic-tutor.md" published_at: "2022-10-07T12:27:27+00:00" modified_at: "2026-08-06T12:06:18+00:00" featured_image: url: "http://localhost/wp-content/uploads/2022/04/20230809-041332.jpg" excerpt: "In the preceding issue of QuarTerS we pointed out how SCREEN$ sees various characters and learned that it recognizes only those having an ASCII code of 32 to 127. In this lesson, we digress from Print Position to learn more about how to program around some of these short comings. First of all, consider the…" category: - name: "Quarters" slug: "quarters" taxonomy: "category" url: "http://localhost/category/periodicals/quarters/" 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: "Tutorial" slug: "tutorial" taxonomy: "post_tag" url: "http://localhost/tag/tutorial/" model: - name: "Timex/Sinclair 2068" slug: "ts-2068" taxonomy: "model" url: "http://localhost/model/ts-2068/" indiv: - name: "Warren Fricke" slug: "warren-fricke" taxonomy: "indiv" url: "http://localhost/indiv/warren-fricke/" publication_r: id: 21505 title: "QuarTerS" type: "periodical" url: "http://localhost/periodical/quarters/" authors: "Warren Fricke" authors_r: - name: "Warren Fricke" slug: "warren-fricke" taxonomy: "indiv" url: "http://localhost/indiv/warren-fricke/" issues_articles: - id: 39507 title: "Quarters Winter 1987" type: "issue" url: "http://localhost/issue/quarters-winter-1987/" pages: "7-8" pubdate: "Winter 1987" archive_link: false --- # TS 2068 Basic Tutor In the preceding issue of QuarTerS we pointed out how `SCREEN$` sees various characters and learned that it recognizes only those having an ASCII code of 32 to 127. In this lesson, we digress from Print Position to learn more about how to program around some of these short comings. First of all, consider the use of `SCREEN$` in SAVEing a screen display to tape. The manual on page 160 gives the format as: ``` SAVE "DISPLAY" SCREEN$ ``` And on the following page there is a format for recalling the display: ``` LOAD "DISPLAY" SCREEN$ ``` Now if you were to use these commands on a screen display made up of all sorts of characters and color, you would find that `SCREEN$` appears to read everything on the screen correctly, as the screen is recalled in all of its glory. Not so. What really happens is expressed by the two alternate, following commands: ``` SAVE"DISPLAY"CODE 16384,6912 LOAD"DISPLAY"CODE 16384,6912 ``` The preceding `SCREEN$` commands were only incorporated in the computer for convenience in a SAVE or LOAD operation. This becomes apparent in a store and recall operation involving the computer’s own memory. To demonstrate, enter and run the following routine, lines 100 to 250, inclusive: ``` 100 FOR R=0 TO 21: FOR C=0 TO 31 110 LET T=RND 120 IF T>.2 THEN PRINT PAPER 7*RND;AT R,C;CHR$ INT (91*RND+32) 130 IF T<.2 THEN PRINT PAPER 7*RND;AT R,C;CHR$ INT (14*RND+129) 140 NEXT C: NEXT R: STOP 200 LET a$="" 210 FOR R=0 TO 21: BEEP .005,1 220 FOR C=0 TO 31 230 LET a$=a$+SCREEN$ (R,C) 240 NEXT C: NEXT R: CLS 250 STOP : PRINT a$ ``` The program will come to a STOP at line 140, allowing you to see a screen display made up of various characters including graphics and PAPER color. About 20 percent of the screen is covered by graphics. Now, by direct entry, use CONT – ENTER. Have patience. It takes about 30 seconds in basic for `SCREEN$` to read and record the display in `a$`. After the screen is recorded, the routine will do a CLS. The next REPORT will be the STOP at line 250. Again use CONT – ENTER and `a$` will be printed out on the screen. But note. We have “lost” all of the graphics because `SCREEN$` did not see these symbols. Now, if we are to remain in basic and store the FULL screen display in memory, replace lines 200 to 250 by the following lines 300 to 370: ``` 300 DIM a(6912): LET T=0 310 FOR n=16384 TO 23295 320 LET T=T+1: LET a(T)=PEEK n 330 NEXT n: CLS : STOP 340 LET T=0 350 FOR n=16384 TO 23295 360 LET T=T+1: POKE n,a(T) 370 NEXT n ``` Again run the program and generate a screen display of various characters and color. When the STOP report of line 140 comes up, direct enter CONT. Have more patience. It takes nearly two minutes to read all 6912 bytes that make up the full screen with its ATTRibutes. As soon as the screen is stored in memory, the screen will do a CLS and a STOP report, line 330 comes up. Again CONT by direct entry. The screen build-up that follows shows the order in which the display file was stored in memory. And, in this instance, everything has been recalled including graphics and color. So far, so good. But it takes nearly two minutes to store and two minutes to recall a full screen in basic. This would never allow us to employ this method for, say animation. Let us digress further, for the time being, and resort to a short machine code routine that transfers blocks of data quite rapidly. Delete lines 300 to 370 and add line 10 and 400 to 1000. The resulting routine looks like this: ``` 10 CLEAR 58431: GO SUB 1000 100 FOR R=0 TO 21: FOR C=0 TO 31 110 LET T=RND 120 IF T>.2 THEN PRINT PAPER 7*RND;AT R,C;CHR$ INT (91*RND+32) 130 IF T<.2 THEN PRINT PAPER 7*RND;AT R,C;CHR$ INT (14*RND+129) 140 NEXT C: NEXT R: STOP 400 RANDOMIZE USR 58432: CLS : STOP 410 RANDOMIZE USR 58444: STOP 1000 REM ** M.C. Routine 1010 FOR n=58432 TO 58455 1020 READ a: POKE n,a: NEXT n 1030 RESTORE 1040 1040 DATA 17,88,228,33,0,64,1,0,27,237,176,201 1050 DATA 17,0,64,33,88,228,1,0,27,237,176,201 1060 RETURN ``` Run the program and again develop a full screen of color and various characters. When the STOP report of line 140 comes up, enter CONT again. The machine code routine triggered by line 400 will almost instantly read and store the screen, and then do a CLS. The program will then come to a STOP, line 400. Now CONT again. Almost instantly the full screen returns with the graphics and color. Such speed allows this method to be used for animation, but the 6912 bytes per full screen may comsume too much RAM for a long, meaningful program, containing many screens. If so, consider animation that may need only a horizontal third of the screen. This would cut the storage requirements considerably. Refer back to the slow BASIC routine that used lines 300 to 370. Its action upon recall illustrates the order in which the screen builds up, both in basic and m.c. We need only select the proper beginning and ending addresses for the characters and ATTRibutes. But a word of caution. If only a third of a screen is considered, the block of characters and the block of ATTRibutes may not be consecutive. This means storing and recalling separate blocks.