Omnimaga
Calculator Community => TI Calculators => Axe => Topic started by: Happybobjr on June 08, 2010, 04:54:16 pm
-
ok i was wandering if there was a way to use numbers over the 255 squared 65000 or what ever.
I am mostly asking this to figure out how to manipulate programs i make and will not ever actually NEED to use this. but it would be nice to learn.
as always, thanks for your time.
-
The trick is to use two numbers I think and put them together (one of them would be from 0 to 9999, to make things easier). I'm gonna try to write a program to demonstrate how it can be done but like last time I awnsered a question someone else will probably come with a clear awnser before me ;D (I guess that's what happen when I am visual x.x)
EDIT: There we go, but the major issue is getting the formatting right :/ (since it's two separate numbers). Basically when the second number reaches 10000 it makes the first increase by 1 and the second is reset to 0
In addition to that, if you have a game where score increases by 10 points multiples, you can simply append a 0 at the end of the score number. This is what Quigibo did in his Pyoro game.
-
thanks i think i understand what you are saying.
my thought was more pointed into imputing numbers instead of outputting
-
ooh ok x.x. I am unsure then :S
-
i would still like to hear your input (lol calculator command) about displaying the larger numbers
-
Note: backup in case I made a typo
0->A->B
Repeat getkey(15)
Text(0,0,B▶Dec
Text((B>9)+(B>99)+(B>999)+(B>9999)+1*4,0,A▶Dec
A+999->A
If A>9999
A-10000->A
B+1->B
End
End
Note I tried adding formatting using boolean logic, like I would do in TI-BASIC, but it didn't work (I mean Text(4+4(B>9)+4(B>99)+4(B>999)+4(B>9999),0,A▶Dec for example)
EDIT: thanks to calc84/dude84se, fixed.
There you go, you have support for a number up to 655359999 (altough it will glitch if you add more than 10000 at once)
-
If you change "If A>9999" to "While A>9999", it will let you add up to 55536 or so without glitching :)
-
not sure what to mean x.x could you explain how to use it?
-
It will keep subtracting 10000 from A and adding 1 to B until A is under 9999 again. Though, if the original addition to A gives a result more than 65535, it won't work properly.
Edit: typo
-
thanks much.... i think i understand all this
-
It will keep subtracting 10000 from A and adding 1 to B until A is under 9999 again. Though, if the original addition to A gives a result more than 65535, it won't work properly.
Edit: typo
I'm even more confused now -.- sorry
-
so this wont correctly count higher than 255 squared?
-
You can always display them manually...
This displays the 32-bit number in the location Str1, but destroys the number afterwards. (range of 0 to 4,294,967,295)
Lets Make Str1 hold 9000*9000 = 81,000,000 In Hex, that's 4D3F640.
:[04D3F640]->Str1
:
:For(D,0,9)
:0->A
:For(B,0,3)
:A*256+{Str1+B}->C^10->A
:C/10->{Str1+B}
:End
:Output(15-D,0,A+'0'▶Frac)
:End
:Disp i
Of course, you can extend this to any arbitrary length.
Please don't ask me how this works. I looked up the algorithm on the learn z80 in 28 days tutorial. I kind of see why it might work, but I don't really know it enough to explain.
-
mhmm interesting, that could be another way to do it I guess. As for the issue regarding adding/substracting a value higher than the part of the number to the right to it, one thing that you can do if you don't need a lot of speed (example: in a RPG at the end of a battle when an enemy gives you 156500 gold at once) is to just gradually increase your gold total by chunks of 10000 until it added 150000 then add the remaining 6500 manually. That said I don't think that's so slow, so it could work in more situations, for example when losing HP in a RPG where damages can exceed 65535
-
Yeah, like in videogames in the 8-bit/16-bit era... In these games, internally, the numbers can't be over 65535 and most games allows you to have more points than that... You will often see games that stops counting at 999999 or 9999990. Also, you will often see at the end of a level the point counter increment by 10 in some fancy way with dings each time it increments.
And I would do 32-bit variables with 2 16-bit variables too.
-
In SUper Mario world, I think when screwing with lives they displayed in hex or with weird chars. Same for damage overflow in Final Fantasy 7.
-
You can always display them manually...
This displays the 32-bit number in the location Str1, but destroys the number afterwards. (range of 0 to 4,294,967,295)
Lets Make Str1 hold 9000*9000 = 81,000,000 In Hex, that's 4D3F640.
:[04D3F640]->Str1
:
:For(D,0,9)
:0->A
:For(B,0,3)
:A*256+{Str1+B}->C^10->A
:C/10->{Str1+B}
:End
:Output(15-D,0,A+'0'▶Frac)
:End
:Disp i
Of course, you can extend this to any arbitrary length.
Please don't ask me how this works. I looked up the algorithm on the learn z80 in 28 days tutorial. I kind of see why it might work, but I don't really know it enough to explain.
could you explain this for me anyone?
:A*256+{Str1+B}->C^10->A