I got a string array subroutine I made in BASIC. It lets you mess with lists except the elements are strings (like this: {"ELEMENT 1","ELEMENT 2","APPLE","ORANGE","BANANAS"} ) rather than numbers since the guys at TI didn't think people would need to be doing that for any reason... and now want to make in ASM because it is really slow in BASIC.

How would I go about making something like this in ASM?
(Yeah, I know I shouldn't be rushing so fast into ASM's deep waters when I already have trouble swimming on the shallow end, but I need this subroutine for some programs I'm making in BASIC).

Any suggestings?
I have a feeling your BASIC method could be optimized to be plenty fast enough; post whatever code you're using now.

Code:
:DelVar XAns→Str7
:expr(sub(Ans,1,1→Z ;Get the function. 1-Get, 2-Find, 3-Replace, 4-Add, 5-Delete, 6-Count
:sub(Str7,2,1→Str6
:sub(Str7,3,length(Str7)-2→Str7
:If Z=6:Goto 6
:1+inString(Ans,"sin-1
:If Ans>1:Then
:sub(Str7,Ans,length(Str7)-Ans+1→Str5
:length(Ans→K
:1+inString(Str5,"sin-1
:If Ans>1:Then
:1+expr(sub(Str5,Ans,length(Str5)-Ans+1→θ
:sub(Str5,1,‾1+inString(Str5,"sin-1→Str5
:End
:sub(Str7,1,length(Str7)-1-K→Str7
:Else
:"sin-1→Str5
:End
:If Z=2:Goto 2
:expr(sub(Str7,1,3→Y
:sub(Str7,4,length(Str7)-3)+Str6→Str7
:DelVar W1→P/Y
:For(X,1,Y
:1+W→W
:min(length(Str7)-1,1+inString(Str7,Str6,P/Y→P/Y
:End
:If Z=1:Goto 1
:length(sub(Str7,Ans,inString(Str7,Str6,Ans)-Ans→X
:If Z=3:Goto 3
:If Z=4:Goto 4
:If Z=5:Goto 5
:Lbl 1
:sub(Str7,Ans,inString(Str7,Str6,Ans)-Ans→Str7
:Goto X
:Lbl 2
:inString(Str7,Str5→X
:If Ans:Then
:1→P/Y:0→PMT
:Repeat Ans=1
:1+PMT→PMT
:1+inString(Str7,Str6,P/Y→P/Y
:inString(sub(Str7,Ans,length(Str7)-Ans+1),Str5
:End
:PMT
:Else
:‾1
:End
:Goto X
:Lbl 3
:If θ>1:Then
:"
:If P/Y>1
:Ans+sub(Str7,1,P/Y-1
:Ans+Str5
:If W<θ
:Ans+sub(Str7,P/Y+X,length(Str7)-X-P/Y
:sub(Ans,2,length(Ans)-1→Str7
:Else
:Str5→Str7
:End
:Goto X
:Lbl 4
:If W<1:Then
:Str5+Str6+Str7→Str7
:Else
:"
:Ans+sub(Str7,1,(P/Y-1)(W<θ)+(W≥θ)length(Str7
:Ans+Str5+Str6
:If W<θ
:Ans+sub(Str7,P/Y,length(Str7)-P/Y
:sub(Ans,2,length(Ans)-1→Str7
:End
:θ+1→θ
:Str7
:Goto X
:Lbl 5
:"
:If θ>1:Then
:If P/Y>1
:Ans+sub(Str7,1,P/Y-2
:If W+1<θ
:Ans+sub(Str7,P/Y+X+(P/Y≤1),length(Str7)-P/Y-X-(P/Y≤1
:sub(Ans,2,length(Ans)-1→Str7
:θ-1→θ
:Else
:" →Str7
:End
:Str7
:Goto X
:Lbl 6
:1→P/Y:‾1→PMT
:Repeat Ans=1
:1+PMT→PMT
:1+inString(Str7,Str6,P/Y→P/Y
:End
:PMT→θ
:Lbl X
:DelVar DelVar DelVar Z
Um... you could change the last line to

Code:
:DelVar Z
foamy3 wrote:
Um... you could change the last line to

Code:
:DelVar Z
I'm gonna guess there are two extra variable tokens there that SC2 didn't render.
Yeah, Str x-with-the-line-over-it, and Str?.
I had to shange then to Str5 (?) and 6 (the x thingy) 'cause of that.

Could the program be optimized any more?
  
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