Jump to content
IGNORED

Drawing the screen after you scroll


Recommended Posts

I have been trying to understand how the scrolling works in the the Example file Landscape.bas 

 

it begins with:

SCREEN screen_cards, 0, 0, BACKGROUND_COLUMNS, BACKGROUND_ROWS, LANDSCAPE_WIDTH

 

So from what I understand, its grabbing the screen data from (Screen cards), the 0 is the origin_offset which is the first data value in screen_cards, the next 0 is the target_offset which is where to start on the screen, then BACKGROUND_COLUMNS (which = 20 in constants.bas) for 20 columns, BACKGROUND_ROWS (=12), then LANDSCAPE_WIDTH (which is set to 60) 

 

Then after it scrolls:

SCREEN screen_cards, next_column, 19, 1, BACKGROUND_ROWS, LANDSCAPE_WIDTH

 

I see that its calling the screen cards again, then changing 0 to next_column (set at 20) ... but here is what is confusing me. what is going on with the 19,1 now?

 

Any help on understanding this is appreciated :)

 

Link to comment
Share on other sites

First, let us have clear how scrolling works, and hopefully everything else will fall into place.

 

The Intellivision supports “hardware smooth scrolling,” with a sort of a trick:  it delays the drawing of a video frame by one or more pixels.

 

For horizontal scrolling, it instructs the electron gun to start drawing up to eight pixels later on each scan line.  This has the effect of shifting the entire video frame a number of pixels to the right.


Vertical scrolling is similar: the STIC instructs the electron gun to skip up to 8 raster lines, which results in the video frame being shifted downwards.

 

Scrolling on an axis in the opposite direction is just a matter of starting at full delay, and reducing the delay one pixel at a time.

 

Because the shifting offset is completely under program control, the video can be smoothly scrolled up to 8 pixels, a full 8x8 card, in any direction.

 

So what do you do when you need to scroll past the first 8 pixels?  The answer to this question leads to an answer to your own question:  you need to shift the entire screen one whole card over, which leaves an empty gap in the opposite side.

 

The border extension is then used to cover the edges of the screen in order to hide the partial gaps as it shifts back and forth.


For example, if you are scrolling to the left, after the hardware scrolls the first 8 pixels, you then shift all the BACKTAB cards on the screen one card to the left, which will leave an empty column at the far right.

 

You then need to draw the newly revealed area of your screen into that new column — and that is what that second SCREEN statement does:  it draws 1 column, starting at column 19, the one in the far right.  Presumably, “next_column” holds the index of the next column to reveal in the original screen data.

 

So, that’s the process of scrolling:

  • Scroll the screen one pixel at a time using hardware scrolling.
  • When you’ve scrolled 8 pixels, shift the entire screen one card over, and reset the scrolling register back to zero for another set of 8.
  • Then draw the new column or row in the gap left after the screen shifted.
  • Lather, rinse, repeat.

I believe the IntyBASIC SCROLL mechanism handles the first two steps for you: shifting the video frame, then shifting the whole screen over.  You then have to draw the new content.

 

I hope this helps.

 

    dZ.

Edited by DZ-Jay
  • Like 1
Link to comment
Share on other sites

1 hour ago, Brian's Man Cave said:

ok, I think its starting to click in now... I assume you can change it to 2 or 3 columns if you wanted more cards at once?.. 

For normal copying of screen data? Yes, you can specify how many columns and rows to copy.  The way SCREEN works is that, if you have screen data that is bigger than the screen, you can tell it which subset of it to copy into a particular region of the screen.

 

For scrolling, though? You only ever copy one column or row at a time.  That’s because that’s as far as the hardware scrolling takes you, so when you need to reset the scrolling register, you must shift the entire screen 8 pixels.  Then you have those 8 pixels to fill with a new card.

 

   dZ.

Link to comment
Share on other sites

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...
  • Recently Browsing   0 members

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