--- title: "Joystick Wrap Around" type: "article" slug: "joystick-wrap-around" url: "http://localhost/article/joystick-wrap-around/" markdown_url: "http://localhost/article/joystick-wrap-around.md" published_at: "2020-10-27T17:10:13+00:00" modified_at: "2026-07-25T23:31:31+00:00" featured_image: url: "http://localhost/wp-content/uploads/2022/04/20230809-041332.jpg" excerpt: "The following BASIC joystick program for the T/S 2068 computer is an enhancement to an original by Warren Fricke, first pub- lished in TIME DESIGNS Sept/Oct 1985 (Vo1.1, No. 6). Keeping the flavor of its predecessor, this program does no more than demonstrate its new potential. Possible applications will be dealt with later. There are…" category: - name: "Time Designs Magazine" slug: "time-designs" taxonomy: "category" url: "http://localhost/category/periodicals/time-designs/" 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/" model: - name: "Timex/Sinclair 2068" slug: "ts-2068" taxonomy: "model" url: "http://localhost/model/ts-2068/" indiv: - name: "Martin DeBoniface" slug: "martin-deboniface" taxonomy: "indiv" url: "http://localhost/indiv/martin-deboniface/" publication: "Time Designs Magazine" publication_r: id: 10277 title: "Time Designs Magazine" type: "periodical" url: "http://localhost/periodical/time-designs-magazine/" authors: "Martin DeBoniface" authors_r: - name: "Martin DeBoniface" slug: "martin-deboniface" taxonomy: "indiv" url: "http://localhost/indiv/martin-deboniface/" volume: "2" issue: "2" issues_articles: - id: 26776 title: "Time Designs Magazine v2 n2" type: "issue" url: "http://localhost/issue/time-designs-magazine-v2-n2/" pages: "20" pubdate: "January/February 1986" archive_link: false volumeissue: "v2n2" --- # Joystick Wrap Around The following BASIC joystick program for the T/S 2068 computer is an enhancement to an original by Warren Fricke, first pub- lished in TIME DESIGNS Sept/Oct 1985 (Vo1.1, No. 6). Keeping the flavor of its predecessor, this program does no more than demonstrate its new potential. Possible applications will be dealt with later. There are two lines of code which make this program tick. All else is superfluous. These two lines are the assignment statements for “column” c and “line” 1 (Stmt #360 and 370). These two assignment statements effectively replace over three dozen IF statements. It reminds me of APL, where the epitomy of programming code is; “See if you can cram it all in one line”. This architectural marvel is made possible by what is known as “BOOLEAN LOGIC AND RELATIONAL OPERATORS”. Boolean Logic, also known as Boolean Arithmetic, is named after George Boole, a 19th century English mathematician and logician. Relational operators are also known as Binary operators. The T/S 2068 user’s manual outlines these very briefly on page 228. HOW IT WORKS: In a nutshell, all I have done is include the statement (-x OR …) twice, within each assignment statement for l and c in the original BASIC joystick routine (see TABLE 1). -x is the parameter limit for each axis -31 for horizontal, and -21 vertical. Sinclair BASIC only allows 0 to 31 characters horizontally and 0 to 21 characters vertically. The inclusion of this bit of code, as in the antecedant program, not only checks for range limitations (eg. < 0), but acts on them as well. Should the joystick direct the cursor beyond the screen range, the limit is reassigned to its opposite value. What does this mean? If you try to go beyond column zero, the cursor is reassigned to the opposite side of the screen and pops up in column 31. Or, if you pass through the right side of the screen, the cursor “wraps around” the sceen and appears on the left. The same with top and bottom. That is why its called a WRAP AROUND screen. What can you do with this you ask? The possibilities are endless. Everything from mouse controlled icons, to word processing aids (not the disease), to games, games and more games. I have deliberately excluded any form of PAUSE statements, mainly because the faster the better. After all, you can only go so fast in BASIC. Finally, if you can appreciate BASIC, with all it’s limitations, then enjoy the following: All- purpose Symbolic Instructional Code. ## Source Code ``` 300 REM Joy STICK Wrapper 310 LET c=10: LET l=10 320 PRINT AT l,c;"*" 330 LET cc=c: LET ll=l 340 LET s=STICK (1,2) 350 LET b=STICK (2,2) 360 LET c=c+((-31 OR c<31) AND (s=8 OR s=9 OR s=10))-((-31 OR c>0) AND (s=4 OR s=5 OR s=6)) 370 LET l=l+((-21 OR l<21) AND (s=2 OR s=6 OR s=10))-((-21 OR l>0) AND (s=1 OR s=5 OR s=9)) 380 PRINT AT 9,9;"FIRE" AND b=1 390 PRINT AT ll,cc;" " AND (ll <> l OR cc <> c) 400 GO TO 320 410 SAVE "JOYSTICK": PRINT #0;AT 0,5;"Rewind ";"Tape to VERIFY ": VERIFY "" 420 STOP 430 REM Meaningful variable names: c=column (0-31), l=line (0-21),cc=concurrent c value,ll=last l value, s=stick value, b=button value (FIRE) 440 REM ```