I am writing a game in Basic for the TI83+. There is a large amount of text in the game, and a lot of it is lowercase. Lowercase is 2 bytes, uppercase is 1 byte. I was thinking that, to save space, I could store uppercase letters as lowercase, and lowercase letters as uppercase. Then, the string would need to be inverted. I was thinking that, while it may be possible to make one in Basic, it would be faster in Asm. I have no experience with Asm, so I was wondering if some one could help me out. Thanks.
Edit 1: I guess I was not very clear. The string I want inverted is Ans, and the output should be stored to Ans. All chars that are not letters should be ignored.
You can easily do this in TI-BASIC, there is no need to use assembly here. You might find the inString() and sub() commands useful.

It might actually be better to just ditch the lowercase text altogether. Most people playing your game will be used to seeing FULL CAPS LETTERING in a calculator game because it is used so often.
How fast would it be in Basic? I have estimated that I would have ~60 KB of text in uppercase (This is a massive text adventure game.) I have a function for printing multiple screens of text, and I tried to get it as fast as I could. How fast would the Basic version be vs. Asm?

Code:

Ans→Str1
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz→Str2
" →Str3
For(A,1,length(Str1
instring(Str2,sub(Str1,A,1
If Ans and Ans≤26:Then
Str3+sub(Str2,Ans+26,1→Str3
Else
Str3+sub(Str1,A,1→Str3
End
End

A string with 260 random characters in it gets converted in ~10 seconds.
That routine only works for uppercase letters. There are better routines available I'm sure Smile
PT_ wrote:
That routine only works for uppercase letters. There are better routines available I'm sure Smile


Code:
Ans->Str1
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz->Str2
" ->Str3
For(A,1,length(Str1
   inString(Str2,sub(Str1,A,1
   If Ans:Then
      Str3+sub(Str2,Ans-26(Ans>26)+26(Ans<26),1->Str3
   Else
      Str3+sub(Str1,A,1->Str3
   End
End

It may not be optimized, but it works exactly like he wants! Very Happy
(Copy/ Paste this into SC then export it from there)
This takes almost 11 seconds to convert 260 random characters. (including numbers)
I found something on omni that could be helpful for turning this into an Axe program: https://www.omnimaga.org/axe-language/routines/msg231479/#msg231479
I tried, but got stuck at trying to concatenate strings.
  
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 UTC - 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