Airshack Posted November 12, 2016 Share Posted November 12, 2016 Looking for some simple code examples of CALL LINK("SCRLUP/DN/RT/LF"..... used to scroll lines by single text in non-circular way. Also, any simple parallax scrolling examples will be greatly appreciated. Not grasping the "redefine the hidden character..." technique on page 7 of the manual. Thx Quote Link to comment Share on other sites More sharing options...
senior_falcon Posted November 13, 2016 Share Posted November 13, 2016 (edited) 100 CALL LINK("SCRN2") 110 FOR COL=1 TO 32 :: CALL HCHAR(24,COL,COL+192):: NEXT COL 120 B$="Episode IV, A NEW HOPE - It is a period of civil war. Rebel spaceships, striking from a hidden base, have won their " 130 CALL LINK("CHPAT2",ASC(B$),CH$):: B$=SEG$(B$,2,255):: CALL LINK("CHAR2",225,CH$) 140 FOR I=1 TO 8 :: CALL LINK("SCPXLF",193,33,1):: NEXT I :: IF B$<>"" THEN 130 150 END How it works: Line 100 sets XB256 to screen 2 Line 110 places the characters from 193 to 224 on the bottom row of the screen. Line 120 is the text we want to scroll across the screen. The pixel scrolling routines do not move the characters on the screen. Instead, they modify the character definitions or patterns. SCPXLF scrolls to the left by moving the definitions for character 124 into character 123. 123 is moved into 122, and so on. In this case, character 225 is not visible, but holds the character definitions that we want to have scrolled into the screen, starting at character 224 and working its way down. We need to redefine character 225 every 8 pixel scrolls. Where do we get these character definitions? Line 130: CHPAT2 gets the character pattern of the 1st character in B$ (ASC(B$) returns the ASCII code of the 1st character in B$). SEG$(B$,2,255) gets rid of the 1st character in B$. CHAR2 redefines character 225. Now that 225 is loaded with the new definition it is time to scroll. Line 140: "SCPXLF",193,33,1 will scroll 33 character definitions one pixel to the left starting with 193. Do this 8 times, then it is time to load character 225 with a new character definition so go to 130 to get the new definition. If you were writing something like Parsec you wouldn't create the definitions on the fly like this. You would probably put them into an array and then use them as needed. (Edit) - If you change line 130 to redefine character 224 instead of 225 you can get a better idea of how this works. Edited November 13, 2016 by senior_falcon 4 Quote Link to comment Share on other sites More sharing options...
Airshack Posted November 13, 2016 Author Share Posted November 13, 2016 The code example and detailed explanation are extremely helpful. Thank you for making BASIC a viable option for TI gaming development. 1 Quote Link to comment Share on other sites More sharing options...
senior_falcon Posted November 13, 2016 Share Posted November 13, 2016 You are welcome! Quote Link to comment Share on other sites More sharing options...
senior_falcon Posted November 15, 2016 Share Posted November 15, 2016 Try out this variation: 100 CALL LINK("SCRN2") 110 FOR COL=10 TO 21 :: CALL LINK("CHAR2",COL+183,""):: CALL HCHAR(24,COL,COL+183):: NEXT COL 120 B$="Press any key " 130 CALL LINK("CHPAT2",ASC(B$),CH$):: B$=SEG$(B$,2,255):: CALL LINK("CHAR2",205,CH$) 140 FOR I=1 TO 8 :: CALL LINK("SCPXLF",193,13,1):: NEXT I :: IF B$="" THEN 120 ELSE 130 Quote Link to comment Share on other sites More sharing options...
Bones-69 Posted February 13, 2017 Share Posted February 13, 2017 This helps cement how the process works a little better. Thanks Harry. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.