Author |
Message |
|
Ben Trettel
Member
Joined: 17 Jul 2003 Posts: 153
|
Posted: 31 Aug 2003 02:50:25 pm Post subject: |
|
|
I need a ASM program that will convert a variable to a string, as you would probably guess, for my RPG Final Conflict. I've been using numStr( in Symbolic, but it screws up when you are writing things to the graph screen. Is there a program like this or could someone make one? What would be best is one that is custom so that I just run it and it looks at the variable specified in the ASM program and puts it to Ans or something. |
|
Back to top |
|
|
Arcane Wizard `semi-hippie`
Super Elite (Last Title)
Joined: 02 Jun 2003 Posts: 8993
|
Posted: 01 Sep 2003 05:47:30 am Post subject: |
|
|
moved from basic forum. |
|
Back to top |
|
|
Ben Trettel
Member
Joined: 17 Jul 2003 Posts: 153
|
Posted: 01 Sep 2003 05:47:47 pm Post subject: |
|
|
Can anyone make this for me? |
|
Back to top |
|
|
Ben Trettel
Member
Joined: 17 Jul 2003 Posts: 153
|
Posted: 03 Sep 2003 05:00:00 pm Post subject: |
|
|
Come on. I really need this. I bet it wouldn't be very hard to make in assembly. If this might make someone make it, I'll give them credit in my game for being so helpful that I couldn't have made the game without you, which is true. |
|
Back to top |
|
|
JacobdeHaan
Member
Joined: 10 Jul 2003 Posts: 165
|
Posted: 03 Sep 2003 07:13:01 pm Post subject: |
|
|
Couldn't you just use basic to do that?
Like this:
Code: :{X,0}->LTEMP1
:{0,X}->LTEMP2
:LinReg(a+bx) LTEMP1, LTEMP2, Y1
:Equ>String(Y1, Str1)
:sub(Str1,1,length(Str1)-4)->Str1
:DelVar LTEMP1
:DelVar LTEMP2
:DelVar Y1
That would come straight from C:\calc\83pa28d\day23.html (on my computer)
The only reason I would see not to use this would be that it is too slow, otherwise it is perfect.
Also...., you just use the expr(Str1->A to get it back into a variable.
edit: If you are still set on needing an asm one, I bet I know enought ASM to make one, just ask.
Last edited by Guest on 03 Sep 2003 07:14:43 pm; edited 1 time in total |
|
Back to top |
|
|
Ben Trettel
Member
Joined: 17 Jul 2003 Posts: 153
|
Posted: 04 Sep 2003 04:40:29 am Post subject: |
|
|
I'm set on having an asm one. From what I have tested, my code is extremely fast for BASIC, and I don't want to sacrafice any speed if I don't have to. Thanks in advance. |
|
Back to top |
|
|
Matt
Member
Joined: 11 Jun 2003 Posts: 169
|
Posted: 04 Sep 2003 04:11:11 pm Post subject: |
|
|
Code:
:{X,0}->LTEMP1
:{0,X}->LTEMP2
:LinReg(a+bx) LTEMP1, LTEMP2, Y1
:Equ>String(Y1, Str1)
:sub(Str1,1,length(Str1)-4)->Str1
:DelVar LTEMP1DelVar LTEMP2DelVar Y1 ;don't forget you can do that (it saves memory!)
Last edited by Guest on 04 Sep 2003 04:13:26 pm; edited 1 time in total |
|
Back to top |
|
|
JacobdeHaan
Member
Joined: 10 Jul 2003 Posts: 165
|
Posted: 05 Sep 2003 12:25:59 am Post subject: |
|
|
Yah, as I said, I copied and pasted straight from 28 days. You could also delete some of the parens and {'things.
If you really do want one in asm, I will do what I can over the weekend. Though I don't even know if I can do it, I can still try. I know how to write to variables, and I think I know how to read them, I just need to be able to move the numbers in floating point things to strings.
feel free to tell me if you think this logic would work:
What I plan to do is have a place like this in my code::
var_name:
.db tT, tE, tS, tT, tI, tN, tG
and using something like ld ix, var_name. and then the ld ix+(whatever),a to edit the string. Would that work?
Does this seem like a good way to run the program? {A,1:PrgmStrings. It would check the list variable ans for the variable you want (A), and then put it into the string specified by the number (1). |
|
Back to top |
|
|
Ben Trettel
Member
Joined: 17 Jul 2003 Posts: 153
|
Posted: 05 Sep 2003 04:59:21 am Post subject: |
|
|
Yeah, that sounds good. |
|
Back to top |
|
|
Tyraniek
Member
Joined: 07 Jun 2003 Posts: 133
|
Posted: 05 Sep 2003 09:23:09 am Post subject: |
|
|
var_name:
.db tT, tE, tS, tT, tI, tN, tG
You could do something more easy which does the same code :
var_name:
.db "TESTING"
Add a 0 if you're expecting to use it with something like _vPuts or _Puts |
|
Back to top |
|
|
Justin W. Shattered Silence
Advanced Member
Joined: 24 May 2003 Posts: 429
|
Posted: 05 Sep 2003 01:36:42 pm Post subject: |
|
|
Ok are you trying to convert a number to a string? If so it is very easy and I'd be glad to explain. |
|
Back to top |
|
|
Ben Trettel
Member
Joined: 17 Jul 2003 Posts: 153
|
Posted: 05 Sep 2003 02:48:52 pm Post subject: |
|
|
Yes. |
|
Back to top |
|
|
Adm.Wiggin aka Tianon
Know-It-All
Joined: 02 Jun 2003 Posts: 1874
|
|
Back to top |
|
|
JacobdeHaan
Member
Joined: 10 Jul 2003 Posts: 165
|
Posted: 05 Sep 2003 06:59:57 pm Post subject: |
|
|
He knows that he can do it in BASIC, but he wants asm. It turns out that I will be gone this weekend, so I won't be able to make the program. But it looks like Justin already has done it, so you would be better of asking him for help anyways.
Just in case though, if you don't get what you need by monday, I can try to make the program then. This is Jacobdehaan, Stardate (whatever) siging off. |
|
Back to top |
|
|
Ben Trettel
Member
Joined: 17 Jul 2003 Posts: 153
|
Posted: 09 Sep 2003 05:38:04 pm Post subject: |
|
|
Could someone make this quick for me? I can't finish Final Conflict without it. |
|
Back to top |
|
|
JacobdeHaan
Member
Joined: 10 Jul 2003 Posts: 165
|
Posted: 09 Sep 2003 09:33:32 pm Post subject: |
|
|
Ok, I'm gonna start attempting this project. I doubt I'll do it, but we'll see. I'm gonna spend about 30 minutes on it right now and see if I even can manage it. |
|
Back to top |
|
|
JacobdeHaan
Member
Joined: 10 Jul 2003 Posts: 165
|
Posted: 10 Sep 2003 01:05:53 am Post subject: |
|
|
Well, this will work when ans is less than 2 digits, amongst other problems:
Code: .nolist
#define end .end
#define END .end
#define equ .equ
#define EQU .equ
#include "include/ti83plus.inc"
#define rstMov9ToOP1 20h
#define rstFindSym 10h
.list
.org 9D95h
bcall(_rclans)
bcall(_convop1)
ex de,hl
push hl
bcall(_disphl)
pop hl
ld b,0
ld ix, data
inc ix
ld a,l
push af
top:
pop af
inc ix
cp 10
jr nc,great
cp 1
jr z,one
cp 2
jr z,two
cp 3
jr z,three
cp 4
jr z,four
cp 5
jr z,five
cp 6
jr z,six
cp 7
jr z,seven
cp 8
jr z,eight
cp 9
jr z,nine
great: ;what to do if ans > or equal 10
inc b
jr top
zero: ld (ix),t0
jr start
one: ld (ix),t1
jr start
two: ld (ix),t2
jr start
three: ld (ix),t3
jr start
four: ld (ix),t4
jr start
five: ld (ix),t5
jr start
six: ld (ix),t6
jr start
seven: ld (ix),t7
jr start
eight: ld (ix),t8
jr start
nine: ld (ix),t9
jr start
dec: ld (ix),tdecpt
start:
push af
ld a,b
cp 1
jr nc,top ;if ans had two or more digits, go back
LD HL,var_name ;now we just store data to the string
RST rstMov9ToOP1 ; Get variable name to OP1
RST rstFindSym ; Check if it exists
JR C,is_okay ; If carry is set, then it doesn't exist
bcall(_DelVarArc) ; Delete it if it does
is_okay:
ld hl,20
bcall(_CreateStrng)
LD HL,data; Copy data over
LD BC,13
LDIR
RET
data:
.db $09, $00, tC, tA, tS, tI, tO, tSpace, tS, tU, tX
var_name:
.db StrngObj, tVarStrng, tStr1, $00
.end
.end
Sorry 'bout the long posts, but does anyone know if this is the best/only way to do what I'm trying, and are there any suggestions for when ans is greater than or equal to 10? |
|
Back to top |
|
|
Justin W. Shattered Silence
Advanced Member
Joined: 24 May 2003 Posts: 429
|
Posted: 10 Sep 2003 06:18:20 pm Post subject: |
|
|
Sorry I have not posted about a solution to your answer. I have been very busy lately and haven't had time to get near a computer to do any programming. Let alone do anything else other than schoolwork. I do have some free time now and I will write a routine to convert a number to a string. There is one flaw that the number cannot be negative, have a decimal, nor can it be larger than 65,535. Will this work for your purposes? If so I will write a routine to do so. If it is necessary I will write a routine that will convert up to a 32bit number to a string. Which means you could have a number between 0 and 16,777,215. |
|
Back to top |
|
|
JacobdeHaan
Member
Joined: 10 Jul 2003 Posts: 165
|
Posted: 10 Sep 2003 06:54:41 pm Post subject: |
|
|
Ummm... I guess this means I'm done? I'm gonna keep trying to get my program working, but I know that Justin knows more about what he's doing than me.
edit: Also, just for the sake of learning, if anyone could look at my previous code and give any suggestions, I would appreciate it.
Last edited by Guest on 10 Sep 2003 06:55:42 pm; edited 1 time in total |
|
Back to top |
|
|
Ben Trettel
Member
Joined: 17 Jul 2003 Posts: 153
|
Posted: 11 Sep 2003 02:44:46 pm Post subject: |
|
|
My numbers won't go higher than 500 or so, or lower than 1 so that should work. |
|
Back to top |
|
|
|