Jump to content

Photo

Coleco Screen Wrap?


4 replies to this topic

#1 Mike Harris ONLINE  

Mike Harris

    Chopper Commander

  • 224 posts

Posted Thu Apr 11, 2019 10:00 AM

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

 



#2 5-11under OFFLINE  

5-11under

    River Patroller

  • 3,398 posts
  • Location:Ontario, Canada

Posted Thu Apr 11, 2019 10:14 AM

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?


#3 Mike Harris ONLINE  

Mike Harris

    Chopper Commander

  • Topic Starter
  • 224 posts

Posted Thu Apr 11, 2019 11:11 AM

I'll try it and post the results.
 

It seems the hardest things in Assembly end up being the easiest in the long run.

 

thanks



#4 ChildOfCv OFFLINE  

ChildOfCv

    Moonsweeper

  • 335 posts

Posted Thu Apr 11, 2019 11:49 AM

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.



#5 nanochess OFFLINE  

nanochess

    Processorus Polyglotus

  • 5,873 posts
  • Coding something good
  • Location:Mexico City

Posted Thu Apr 11, 2019 12:36 PM

Repeat the data at the end, so you don't have to add a lenghty comparison inside the loop.

 

The start pointer is the only that should return to 0 once you reach 24.






0 user(s) are browsing this forum

0 members, 0 guests, 0 anonymous users