Jump to content
IGNORED

XB256: parallax and non-circular scrolling?


Airshack
 Share

Recommended Posts

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

Link to comment
Share on other sites

gallery_34177_1071_106171.gif

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 by senior_falcon
  • Like 4
Link to comment
Share on other sites

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
Link to comment
Share on other sites

  • 2 months later...

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...