Login [Register]
Don't have an account? Register now to chat, post, use our tools, and much more.
Name of the program withheld now...
This is going to be a calculator where you type in (using the keys) expressions, but the plan is that you can type in other functions not built-in to the CE, ex. sec( or sinē(, and maybe some others, and use inString loops to turn characters into actual tokens. (And expr( will be used at the end of the converted string.)



More will be coming in the future.
Pretty cool
I had made a BASIC/ASM de-tokenizer for this kind of project a while back, which I think you might want to see. The syntax to use it is basically as follows:

Code:
[command name](param1,param2,[...])

So a sec() command would look like this:

Code:
SEC(π)

Here is the code for it, it might be useful for this project...

Code:
Input "",Str1
{0->L1
{1,6,10,15,22,25,28,31,35,40,44->L2
inString("GAMMAQUADCUBICQUARTICCOTSECCSCZETABCONVBETAISPRIME",sub(Str1,1,~1+inString(Str1,"(
Ans=L2
sum(AnscumSum(binomcdf(10,0->N
If N
augment(DeltaList(L2),{7
expr("{"+sub(Str1,Ans(N)+2,length(Str1)-Ans(N)-1->L1
Asm(prgmTOVARS

The input string is in Str1, L2 contains the index to the command name in the list of commands. It searches for the command in the list, then a number is stored to N based off the result (0 is the first command, 1 is the 2nd and so on)
It then grabs the parameters part of Str1 and stores them as elements in L1.
TOVARS just stores the values of L1 to system variables (first element gets stored to A, 2nd element to B and so on)
Here is the code for TOVARS (adapted for the CE from tibasicdev):

Code:
   call _ZeroOP1
   ld a,$AA
   ld ($8479),a
   rst 10h
   jr nc,$+17
   ld a,$40
   ld b,$1B
   ld hl,$86EC
   inc a
   ld (hl),a
   inc hl
   djnz $-3
   ld de,$86EA
   inc de
   inc de
   push de
   call _RclAns
   cp $01
   ret nz
   ld a,(de)
   cp $1B
   jr c,$+4
   ld a,$1B
   ex de,hl
   inc hl
   inc hl
   ld b,a
   pop de
   ld a,(de)
   inc de
   push de
   push bc
   push hl
   push af
   call _ZeroOP1
   pop af
   ld ($8479),a
   rst 10h
   jr nc,$+5
   call _CreateReal
   pop hl
   ld bc,$0009
   ldir
   pop bc
   djnz $-27
   pop de
   ret

Here it is compiled:

Code:
CD8403023EAA32798400D7300F3E40061B21EC86003C772310FB11EA86001313D5CD500F02FE01C01AFE1B38023E1BEB232347D11A13D5C5E5F5CD840302F132798400D73003CD340502E101090000EDB0C110E3D1C9

This way, you know what command was called (N) and what parameters were passed (A,B,C,[...]).
For the command index, I was thinking of using (once again) inString( to replace whatever text that had the commands with something TI-Basic can understand, before using expr(

Example:
7sec(pi/2), where sec( would be lowercase tokens and the "(".
Then I'd try to replace sec( with "1/cos("
ShinyGardevoir wrote:
For the command index, I was thinking of using (once again) inString( to replace whatever text that had the commands with something TI-Basic can understand, before using expr(

Example:
7sec(pi/2), where sec( would be lowercase tokens and the "(".
Then I'd try to replace sec( with "1/cos("

This doesn't allow for much flexibility... That method only works for expressions that have an easy translation like sec() and sinē(). If you wanted to do something like get the prime factors of a number or convert it to another base, you couldn't just replace like that...
I might not do the prime factorization/base converter; I already made a base-converter program, in the 84+ CE Basic Misc. Programs.
I did create a program that allows sec, csc, and cot once.
  
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 GMT - 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