I'll start it off with a random program, "Mul(TI)task v1.2" by David Matthews. His original code (616-byte program file):

BASIC Code wrote:
::"MULTI TASK CALC
:0→A
:ClrHome
:0→C
:"(^-1)sin(cos(tan(^²E()/log(789*ln(456-√(123+10^0.‾"→Str8
:" "→Str7
:" "→Str9
:While getKey≠22
:If K=15
:Then
:0→C
:" "→Str9
:0→A
:ClrHome
:End
:"AM"→Str0
:getTime→L1
:If L1(1)≥13
:Then
:L1(1)-12→L1(1)
:"PM"→Str0
:End
:
:Output(3,2,Str9
:Output(6,1," "
:Output(1,3," "
:Output(1,6," "
:Output(1,9," "
:Output(1,2,L1(1)
:Output(1,4,":"
:Output(1,5,L1(2)
:Output(1,7,"."
:Output(1,8,L1(3
:Output(1,12,Str0
:Output(6,1,A
:getKey→K
:If C=1 and K=45
:Then
:"0"→Str9
:0→A
:ClrHome
:End
:
:If K=11
:Then
:0→A
:1→C
:">"→Str9
:End
:
:If C=1 and K=23 and length(Str9)>1
:Then
:sub(Str9,1,length(Str9)-1)→Str9
:ClrHome
:End
:If C=1 and K=105
:Then
:expr(sub(Str9,2,length(Str9)-1))→A
:">"→Str9
:ClrHome
:End
:
:If C=1 and K>60 and K<105
:Then
:"BEGIN MULTI TASKIN'
:K-50→N
:N→θ
:If N≥10
:Then
:N/10→S
:int(S)→S
:5*S→U
:N-U→θ
:End
:Str9+sub(Str8,θ,1)→Str9
:End
:End
:ClrHome
:Stop
Generated by SourceCoder, © 2005 Cemetech


My improved version, using mostly the simplest of optimization tricks. The main slowdown in the program is the redrawing of the time on every..single..loop, which is easy to fix (although I did not). Thoughts?

BASIC Code wrote:
::"MULTI TASK CALC
:DelVar ADelVar CClrHome
:"(^-1)sin(cos(tan(^²E()/log(789*ln(456-√(123+10^0.‾"→Str8
:" →Str7
:" →Str9
:Delvar KRepeat K=22
:If K=15
:Then
:DelVar CDelVar A" →Str9
:ClrHome
:End
:"AM→Str0
:getTime→L1
:If 13<=L1(1
:Then
:L1(1)-12→L1(1
:"PM→Str0
:End
:
:Output(3,2,Str9
:Output(6,1,"
:Output(1,3," : :
:Output(1,2,L1(1
:Output(1,5,L1(2
:Output(1,8,L1(3
:Output(1,12,Str0
:Output(6,1,A
:getKey→K
:If C=1 and K=45
:Then
:"0→Str9
:DelVar AClrHome
:End
:
:If K=11
:Then
:Delvar A1→C
:">→Str9
:End
:
:If C=1 and K=23 and 1<length(Str9
:Then
:sub(Str9,1,length(Str9)-1→Str9
:ClrHome
:End
:If C=1 and K=105
:Then
:expr(sub(Str9,2,length(Str9)-1→A
:">→Str9
:ClrHome
:End
:
:If C=1 and K>60 and K<105
:Then
:K-50→N
:N→θ
:If N≥10
:Then
:N/10→S
:int(S→S
:5S→U
:N-U→θ
:End
:Str9+sub(Str8,θ,1→Str9
:End
:End
:ClrHome
Generated by SourceCoder, © 2005 Cemetech
I can't figure out what it does.
Will_W wrote:
I can't figure out what it does.
Well, it displays the time and date on the top two lines of the homescreen, and it stores operands (0-9, +-/*, log, ln) into a string until you hit enter, at which point it expr()'s the string.
Quote:
::"MULTI TASK CALC
:DelVar ADelVar CClrHome
:"(^-1)sin(cos(tan(^²E()/log(789*ln(456-√(123+10^0.‾"→Str8
:" →Str7
:Ans→Str9
:Delvar KRepeat K=22
:If K=15
:Then
:DelVar CDelVar A" →Str9
:ClrHome
:End
:"AM→Str0
:getTime→L1
:If 13<=L1(1
:Then
:L1(1)-12→L1(1
:"PM→Str0
:End
:
:Output(3,2,Str9
:Output(6,1,"
:Output(1,3," : :
:Output(1,2,L1(1
:Output(1,5,L1(2
:Output(1,8,L1(3
:Output(1,12,Str0
:Output(6,1,A
:getKey→K
:If C=1 and K=45
:Then
:DelVar A"0→Str9
:End
:
:If K=11
:Then
:Delvar A1→C
:">→Str9
:End
:
:If C=1 and K=23 and 1<length(Str9
:sub(Str9,1,length(Str9)-1→Str9

:If C=1 and K=105
:Then
:expr(sub(Str9,2,length(Str9)-1→A
:">→Str9
:End
:
:If C=1 and K>60 and K<105
:Then
:K-50→N
:N→θ
:If N≥10
:Then
:N/10→S
:int(S→S
:5S→U
:N-U→θ
:End
:Str9+sub(Str8,θ,1→Str9
:End
:ClrHome
:End
Generated by SourceCoder, © 2005 Cemetech
Thank you all for the help!
This just shows that the calc community is not dead after all!
Graphing Calculator
so I was thinking about adding "2nd" functions,
would that be too much?

P.S the original code had IF/Then statements for all supported key presses Surprised Now that was really slow... Laughing
I don't think that would be too much. Have you considered some kind of counter such that it only updates the time once every few, half-dozen or ten, cycles of key checking? That should help you a lot with the lag.
Why not use getTmFmt()?
  
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