Jump to content
IGNORED

Coleco Screen Wrap?


Recommended Posts

Can someone provide a mathematical formula or code to wrap text around the screen?

I have looked all over Coleco and MSX forums but have come up empty.

Say I have a block of data such as;

 

DB 00,01,02,03,04,05,06,07,08,09,10,12,13,14,15,16,17,18,19,20,21,22,23

 

So if I shift this all to the right say 6 spaces how can I have this display on the same line when it hits the end of the screen like this example;

 

18 19 20 21 22 23 00 01 02 03 04 05 06 07 08 09 10 12 13 14 15 16 17

 

Or if I take away I would do the same but in reverse like this;

 

06 07 08 09 10 12 13 14 15 16 17 18 19 20 21 22 23 00 01 02 03 04 05

I have been wracking my brain on this for about month before I bother you guys.

 

 

 

TIA

MH

 

Link to comment
Share on other sites

Use a pointer...

 

Keep the data at 00-23, always.

Use a pointer to find the starting point. Whenever you hit 24, basically subtract 24 from the pointer. If you get less than 00, add 24.

 

For instance, in you examples above...

Initial starting point was 00.

Go right 6, so subtract 6, so you have -6 - is less than 0, so add 24... 18. Start at 18, when you hit >23, subtract 24 so you're back at 0, etc.

Initial starting point was 00.

Go left 6, so add 6, so you have 6. Start at 6, when you hit >23, subtract 24 so you're back at 0, etc.

Does that help, or no?
Link to comment
Share on other sites

More generally, have a 2-stage loop. The first stage starts in the middle of your array (but beginning of line on the screen) and outputs until the end of the wrapping data. The second stage finishes what's left to display back at array element 0 and up. This saves you from changing the display address between stages.

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...