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