I'm writing a program and I needed a way to turn numbers (maybe in ans) to strings so I can store them to a string. I then did some research and found that there is really no good way to do this without doors and since the CE doesn't have doors I want to know if there is a way to use the Asm84CEprgm command and some hex to do just that. Is there one? Thanks in advance!
There's this. It has number-to-string conversion.
I don't want to use any libraries because I don't want to have people have to have that library when they download this program. I really see Asm84CEprgm as the only option. Maybe if an assembly-able user comments on this we can see if it actually exists.
What about a pure BASIC solution to convert a number to a string?
KermMartian wrote:
What about a pure BASIC solution to convert a number to a string?

Yes, this is alright, but it is awfully slow and overwrites some odd vars, I think he was trying to avoid this kind of awkward manipulation because if he intends to do this many many times, maybe for some data storage purposes, then it may take some time... And since it is available in some libs, we can assume it can be done in asm, and could thus be done in hex Razz and probably considerably faster than the pure ti-basic solution.
Yes, you are correct in multiple places mr womp womp. I will be doing this operation many many MANY times and I need it to be fast (relative to BASIC) and I do want the hex asm solution to this. Smile thanks for clarifying.
AFAIK there is no easy pure assembly way to do this without some fancy floating point magic. The way I see it, you have three main options:
1. Wait until Doors CE comes out.
2. Use TextLib (probably just until Doors CE comes out)
3. Download TextLib and use the number-to-string routine that is in there. (i.e. copy it into your assembly program) This is probably what I would recommend, although you might want to double-check some READMEs and make sure DrDnar is okay with it.
4. Write your own.

Good luck!

P.S. If you are dealing with 1-byte, 2-byte, or 3-byte integers rather than floating point numbers, which is probably what you would be doing if you are working in assembly, then I have some routines I can give you for that. Also look into the _DispHL ROM call.
Hmm... If there is no way to do this with Asm84CEprgm[HEX] then I guess I'll have to use tiBASICdeveloper's slow way until, like you said, Doors CE comes out. But my question is if Doors CE can do it with Celtic which is asm why cant they (whoever made Celtic (I think Kerm right?)) simply use the asm that does num to strn in celtic to change into hex? I don't know if it works that way, I know next to nothing about asm code but I hope eventually there will be something that emerges. Thanks for the reality check though Hactar Smile
Botboy3000 wrote:
Hmm... If there is no way to do this with Asm84CEprgm[HEX] then I guess I'll have to use tiBASICdeveloper's slow way until, like you said, Doors CE comes out. But my question is if Doors CE can do it with Celtic which is asm why cant they (whoever made Celtic (I think Kerm right?)) simply use the asm that does num to strn in celtic to change into hex? I don't know if it works that way, I know next to nothing about asm code but I hope eventually there will be something that emerges. Thanks for the reality check though Hactar Smile


I'm a bit confused. Do you want to convert a number (floating point, used in BASIC, or integer, used in ASM?) into a hexadecimal string? And is this for a BASIC program or an assembly program? If you are using BASIC floating points, does this routine/library have to support decimals and fractions and stuff? How fast does this routine have to be? Will it be in the main update loop/routine for some program?
I want to convert a number (say 5 for example) to a string witch the calc sees as "5" using the Asm84CEprgm command folowed by hexidecimal code (how you do asm in BASIC prgms.) Does this clear things up for you?
Botboy3000 wrote:
I want to convert a number (say 5 for example) to a string witch the calc sees as "5" using the Asm84CEprgm command folowed by hexidecimal code (how you do asm in BASIC prgms.) Does this clear things up for you?


Yes. There is no way to do that unless you wait for Doors, use someone else's library (DrDnar's would be a good options until Doors is released), or create your own (which I don't recommend as it is more work for you and for the user). There's really no way to do that without a library.
I don't know about that. Kerm was telling me that Mateo said it could be done in just a few bcalls (whatever those are) and it would be simple. but now I'm evern more connfused because I have two conflicting answers to this question. I guess we'll have to wait for mateo's post. He got his hands on a tI 84 something yesterday and said he started working on it but idk if he actually will/has Razz
Botboy3000 wrote:
I don't know about that. Kerm was telling me that Mateo said it could be done in just a few bcalls (whatever those are) and it would be simple. but now I'm evern more connfused because I have two conflicting answers to this question. I guess we'll have to wait for mateo's post. He got his hands on a tI 84 something yesterday and said he started working on it but idk if he actually will/has Razz


Kerm and Mateo are talking about a solution that would be possible to implement into an assembly program. You (if I understand correctly) are writing a BASIC program and want an assembly library that can convert a number to a string. (That's what TextLib, Celtic, and the Doors SDK are: assembly programs that run in the background, intercepting certain TI-BASIC tokens before they are executed and instead doing something magical with them.) You (unfortunately) cannot insert assembly directly into a BASIC program; it must be in a separate one which can then be used by a BASIC program. There is no way to accomplish what you want without either using someone else's library, whether it comes from Doors CE or DrDnar's TextLib, or writing your own (which would still have to be a separate program loaded onto the user's calculator for your program to work).

Hope that clears things up a bit. Wink
On the contrary, The Asm84CEprgm command can be followed by hex code which does exactly that -- assembly in a BASIC program, I've evern used it before. All it does from what I understand from watching people use it in the past is take hex codes from different assembly commands and the calc knows what they are so it interprets whatever is after the Asm84CEprgm command as an assembly program while still inside a BASIC program. The advantage of using the Asm84CEprgm command is that you don't need an asm library to accomplish fast assembly functions. You just need to know what characters to put after it. Agreed, asm libraries make it ten-thousand times simpler if you're just using one calc but another advantage of using Asm84CEprgm is that you can send your program to another calc and it will work with no libraries or doors or anything. Pure calculator power Smile
I do see that the Asm84CEprgm command, ti says it needs to be at the top of a program. That's simple and I think this is what you were getting atm. Usage.
Botboy3000 wrote:
On the contrary, The Asm84CEprgm command can be followed by hex code which does exactly that -- assembly in a BASIC program, I've even used it before.

I'm sorry to say that this is actually not the case. Assembly programs must be run separately from a basic program due to TI's lack of implementation of a neat feature. Razz (Not that I am saying anything) Anywho. Adrien and some others were wondering about a possibility to "stringify" variables in TI-BASIC (as the TI83PCE has an exact math engine), and this topic brought back that memory. So I wrote up some code, tested it on the emulator for a TI84+, and then converted the code to be useable on the TI-84+CE, which Adrien then tested for me. Now, this simple code can convert matrices, complex numbers, real and irrational numbers, and pretty much everything else to a string. Since the Cemetech archives aren't working for some reason, here's a link until they do. Since I had to write this for the monochrome calcs, there are now two versions. Enjoy, and I hope this helps somewhat. I know it is not exactly what you are looking for, but it works awesomely. Smile

CE version: Download

SE version: Download

Here's the code as well if anyone is interested. First time as far as I know anyone has used this technique:


Code:
 or a,a
 sbc hl,hl
 call _createtstrng
 push de
  call _PushRealO4
 pop de
 call _SetEmptyEditPtr
 
 call _ansname
 call _rclvartoedit
 call _closeeditequ
 
 call _PopRealO1
 jp _StoAns


Usage:


Botboy3000 wrote:
...but idk if he actually will/has Razz

Of course I will/has Razz
Many thanks Mateo Smile
Indeed this will be very useful, especially for advanced math programs (and, on the 83PCE, with the new exact types, there were literally no way or tricks to get a string value of a result...)

Edit: here's another cool screenshot, showing the mathprint exponential, since √90 was already in the matrix, simplified as 3√10:
Thanks guys! This is a great help! I'm really glad there was a (relatively) simple way to do this and thanks for correcting me on the Asm84CEprgm thing. I knew I had used it before but (as you said) was completely independent from a BASIC program now that I went back and found it. I'll be sure to post my final program in the archives (hopefully they'll be working by then.)
  
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