Login [Register]
Don't have an account? Register now to chat, post, use our tools, and much more.
I need some help optimizing some code, which right now is unacceptably slow.

So once again I am only posting snippets because I don't want to reveal the project just yet, but in said mystery project, there is a place where I need to display and edit multi-line text, with some "tokens". So far I am storing normal ascii characters as 1-byte values from 0-127, and the newline character is 128. 129-255 will be used for said "tokens" which are not implemented yet. The string is being stored in L1, and the length of the string is in EDITLENGTH.
My code is as follows:

Code:

Lbl DRAWEDIT
SetTextXY(1,11)
min(EDITLENGTH,858)->LENGTH        [i] is the string shorter than the max amount of displayable characters?
For(I,0,LENGTH)        [i] for every currently displayable character...
   If (*{L1+I})<128        [i] if a normal ascii value...
      PrintChar(*{L1+I})
   End
   If ((*{L1+I})=128) or (GetTextX)>310)        [i] if newline character or wordwrap is applicable
      If GetTextY)>229          [i] if at the end of the screen
         LENGTH->I        [i] exit the loop
      End
      BlitLines(1,GetTextY),10)        [i] display line
      SetTextXY(1,GetTextY)+10)        [i] go to next line
   End
End
Return


Having not tested this in Cemu, I don't know the exact fps but I think it's like maybe 3.
Any and all help is appreciated!

[Sorry again for my sub-par english.]
  
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
Page 1 of 1
» All times are GMT - 5 Hours
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

 

Advertisement