Is anything wrong here? It keeps crashing on the second run from TI-OS, and the Axe app crash after running this.

Code:
0->S->T->X+1->Y
ClrHome
GetCalc("appvTEMP",2000)->Q
!If Q
Fill(Q,2000,0)
For(A,0,length(P))
   If {P+A}=10
      T++
      0->S
   Else
      Copy(P+A,80*T+Q+S,1)
   End
End
Else
End
Disp P
Repeat getKey
End
ClrHome
Disp Q
Repeat getKey
End
ClrHome


P is a pointer pointing to an AppVar.
Guess Q is too large.
Jeff calc 84 wrote:
P is a pointer pointing to an AppVar.

Can you give what P is actually pointing to? I don't know what exactly its used for, like what's the size and the like?
P is pointing to an AppVar that has a max size of 2000 bytes.
Also, can "presending" the TEMP appvar solve the problem? just asking.
New code:

Code:
0->S->T->X+1->Y
ClrHome
GetCalc("appvTEMP",2000)->Q
If Q
Fill(Q,2000,0)
For(A,0,length(P))
   If {P+A}=10
      T++
      0->S
   Else
      Copy(P+A,80*T+Q+S,1)
   End
End
Else
End
Disp P
Repeat getKey
End
ClrHome
Disp Q
Repeat getKey
End
ClrHome


also might just be that Q overwrote code from 0x0.
Jeff calc 84 wrote:

Code:
GetCalc("appvTEMP",2000)->Q
If Q
Fill(Q,2000,0)

Why is the "If Q" there? Q is always going to equal the pointer to Q so you can safely 'reset' the appvar without risking the device's integrity.

I had to fix this issue for a similar situation with an appvar for a map.
My Code:

Code:
GetCalc("appvMAP")->A
If A=0
GetCalc("appvMAP",400)->A
Fill(A,400,2)
End


Also, if the variable is going to be deleted after program termination, I would set it as a temp variable [2nd]->[9].

Code:
GetCalc("tmpTEMP",2000)->Q

That removes the need to reset it every time you run the program because it will delete itself after program termination.
If you need the variable to persist though the best course of action would be to use an equivalent of my code listed above, the only caveat is that it can bug out if you are coding for a Shell like DoorsCS.

Edit: Fixed Minor grammatical errors (I'm a perfectionist)
Short routine for inputting numbers without using Input.
You may tweak it as you please.


Code:
33->{L4}
34->{L4+1}
26->{L4+2}
18->{L4+3}
37->{L4+4}
27->{L4+5}
19->{L4+6}
36->{L4+7}
28->{L4+8}
20->{L4+9}
ClrHome
Disp "Input? "
0->Q
Repeat getKey(54)
   getKey->K
   If K
      0->B+1->G
      While B<10 and G
         If K={L4+B}
            0->G
            B--
         End
         B++
      End
      !If G
         Q*10+B->Q
         Pause 500
      End
   End
End
Jeff calc 84 wrote:
Short routine for inputting numbers without using Input.
You may tweak it as you please.

I already had a routine that gets the same general result.

Code:
.TYPING
Data(47,39,31,46,38,30,22,14)->A
"ABCDEFGH"->Str0
Repeat getKey(15)
   inData(getKey,A,8)->B
   If B>0
      Str0->C
      Output(0,0,{C+B}-1>Char)
   End
End

Data() holds the keycodes, and each keycode corresponds with a position in the list. By pulling the equivalent character or number from an alternate data set we get the exact same effect.
Is the getKeyS function's keycode really just these keycodes?
https://taricorp.gitlab.io/83pa28d/lesson/week4/day22/index.html#matrix-layout
Jeff calc 84 wrote:
Is the getKeyS function's keycode really just these keycodes?
https://taricorp.gitlab.io/83pa28d/lesson/week4/day22/index.html#matrix-layout


You could test it yourself as a good exercise!
Make a program that will repeatedly check that command and give you the key codes from that command while also only displaying when there is any key input. Make sure to add a way to end the program!
Usefull routine:
Bezier Quadratic (Usefull for like a visual quadratic solver)

Code:
.BRV
.00-40,20-80,0
0->T->X->Y
[FFFFFFFFFFFFFFFFFF]->GDB0
[000000000000000000]->GDB1
ClrDraw
Repeat getKey(15)
   If T<257
      BVR(0,0,10,54,70,30)
      If T
      End
      Pt-On(A/256,B/256,GDB0)
      DispGraph
      Pt-Off(A/256,B/256,GDB1)
      T+2->T
   End
End
Return

Lbl BVR
(1.0-T)^^2^^r*[r1]+(1.0-T*2**T*[r3])+(T^^2^^r*[r5])->A
(1.0-T)^^2^^r*[r2]+(1.0-T*2**T*[r4])+(T^^2^^r*[r6])->B




T needs to be incremeanted from 0 to 257 between each run.
A and B are 8.8 format so /256 to use them in like Pt-On()
Hayleia wrote:
There's already the built-in command Freq in Axe. But sound and music are really resource intensive on a calculator.

Where is that token found?
I've looked everywhereee
DragonScholar71 wrote:
Jeff calc 84 wrote:
Short routine for inputting numbers without using Input.
You may tweak it as you please.

I already had a routine that gets the same general result.

Code:
.TYPING
Data(47,39,31,46,38,30,22,14)->A
"ABCDEFGH"->Str0
Repeat getKey(15)
   inData(getKey,A,8)->B
   If B>0
      Str0->C
      Output(0,0,{C+B}-1>Char)
   End
End

Data() holds the keycodes, and each keycode corresponds with a position in the list. By pulling the equivalent character or number from an alternate data set we get the exact same effect.


Is there a way to get the output as another string and also how do i do a backspace?
Nourayenner wrote:
Hayleia wrote:
There's already the built-in command Freq in Axe. But sound and music are really resource intensive on a calculator.

Where is that token found?
I've looked everywhereee


scroll to the bottom of this page:
http://axe.eeems.ca/Commands.html
It's a custom token, pressing 2nd and then 0, then the key with a green S next to it may help. Of course, you need to do this when editing an axe program.

You should really read this: https://www.cemetech.net/about/rules/
Jeff calc 84 wrote:

You should really read this: https://www.cemetech.net/about/rules/

Sorry 😔 I am new

Code:
Data(33,34,26,18,35,27,19,36,28,20)->M
         0->I
         Repeat getKey(54)
            inData(getKey,M,10)->B
            If B
               B--
               Disp B+48>Char
               I*10+B->I
               Pause 500
            End
         End

Number entering routine! 1000% better than plain input !
I'm trying to write to any of the external OS strings based on the value of F (the user will select which string to write to, and the option they choose is in F). Is there a more efficient way than doing this?

Code:
If F=0:"Str0"→V:End
If F=1:"Str1"→V:End
If F=2:"Str2"→V:End
If F=3:"Str3"→V:End
If F=4:"Str4"→V:End
If F=5:"Str5"→V:End
If F=6:"Str6"→V:End
If F=7:"Str7"→V:End
If F=8:"Str8"→V:End
If F=9:"Str9"→V:End
GetCalc(V,16)→A
You should be able to do some ASCII magic to turn the numeral 0~9 into the character 0~9, like this:

Code:

If 0<=B and (B<10)
B+32->A
End
"Str"+A->C

Word of caution: OS Strings are token strings...
Here are some input routines I wrote yesterday:

Get number:
This allows the user to type with the number keys, 0-9.
Code:
Data(33,34,26,18,35,27,19,36,28,20)->GDB1
ClrHome
Repeat getKey(54)
   getKey
   inData(,GDB1)
   If
      Disp +47>Char
   End
End


Get letter:
This allows the user to type letters using the corresponding keys. On the Disp line, the 64 can be replaced with a 96 to type in lowercase instead of uppercase.

Code:
Data(47,39,31,46,38,30,22,14,45,37,29,21,13,44,36,28,20,12,43,35,27,19,11,42,34,26)->GDB1
ClrHome
Repeat getKey(54)
   getKey
   inData(,GDB1,26)
   If
      Disp +64>Char  //replace 64 with 96 for lowercase, uppercase otherwise
   End
End


Get letter or number:
This allows the user to type in uppercase, lowercase, or numbers. The program begins with uppercase enabled; pressing the Alpha key toggles between uppercase, lowercase, and numbers.

Code:
Data(47,39,31,46,38,30,22,14,45,37,29,21,13,44,36,28,20,12,43,35,27,19,11,42,34,26)->GDB1
Data(33,34,26,18,35,27,19,36,28,20)->GDB2
1->A
Repeat getKey(54)
   A=0?96->P,64->P
   getKey->K
   If K=48
      If A
         A--
         Else
         2->A
      End
   End
   If A!=2
      inData(K,GDB1,26)
      If
         Disp +P>Char
      End
      Else
      inData(K,GDB2,10)
      If
         Disp +47>Char
      End
   End
End


Feel free to use them as you please, edited or unedited. Credit is appreciated, though not required. Enjoy!
Here's something directly taken from the Command List:
Quote:
L3 768 bytes (appBackUpScreen) Volatility: MED (Saving to back-buffer will corrupt)

What does it mean?
Im pretty sure the back buffer is the second buffer used while doing greyscale.
Jeff calc 84 wrote:
Short routine for inputting numbers without using Input.
You may tweak it as you please.


Code:
33->{L4}
34->{L4+1}
26->{L4+2}
18->{L4+3}
37->{L4+4}
27->{L4+5}
19->{L4+6}
36->{L4+7}
28->{L4+8}
20->{L4+9}
ClrHome
Disp "Input? "
0->Q
Repeat getKey(54)
   getKey->K
   If K
      0->B+1->G
      While B<10 and G
         If K={L4+B}
            0->G
            B--
         End
         B++
      End
      !If G
         Q*10+B->Q
         Pause 500
      End
   End
End


Wait what? You can define lists that way? Thought that you could only use CopyData( ??
  
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
» Goto page Previous  1, 2, 3 ... , 12, 13, 14  Next
» View previous topic :: View next topic  
Page 13 of 14
» 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