Author Topic: Axe Parser  (Read 553960 times)

0 Members and 4 Guests are viewing this topic.

Offline Quigibo

  • The Executioner
  • CoT Emeritus
  • LV11 Super Veteran (Next: 3000)
  • *
  • Posts: 2031
  • Rating: +1075/-24
  • I wish real life had a "Save" and "Load" button...
    • View Profile
Re: Axe Parser
« Reply #225 on: March 13, 2010, 09:57:40 pm »
The looping around effect happens regardless of sign.  0 decrements to 65535 the same way -32768 decrements to 32767.  Like I said, addition and subtraction are not affected by this change.  -1 is still -1.  The only time it would change is when you multiply and divide with numbers larger in magnitude than 32767.  And I should also mention that the inequality operators will also be affected.

The looping goes on forever if you keep passing the limit.  Unlike Basic, you will never get an overflow error, it will just overflow in such a way that only the least significant bits, that is to say the 16 bits on the rightmost side of any result larger than 16 bits, will be returned.  That's why its very important to put caps on things like scores, health, and lives that you definitely DON'T want to loop around once they overflow.
___Axe_Parser___
Today the calculator, tomorrow the world!

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: Axe Parser
« Reply #226 on: March 13, 2010, 10:04:48 pm »
Aaah ok.

Generally, in my RPGs, damage and HP are 9999 max, but if my defense system uses multiplying/dividing, like most of my games, then it can be problematic for example if I cast Holy at maxed out stats against a zombie. The trick would be to either have defense be substracted from damage and have damage never go below 0. That can be a bit problematic when it comes to balancing the game, though. Another trick, which is the easiest, is to go the Final Fantasy 13 way and just get rid of defense altogether.

Generally, I recommend under such limits to set HP to like 999 max, though, so you have less worries. For gold, 999 or 9999 can do. Zelda had 999 after all :P

Offline ztrumpet

  • The Rarely Active One
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 5712
  • Rating: +364/-4
  • If you see this, send me a PM. Just for fun.
    • View Profile
Re: Axe Parser
« Reply #227 on: March 13, 2010, 10:05:34 pm »
I'm okay with the change, but I wonder about Builderboy.  A lot of his stuff has things like (#>65000) in it, so he can use negative numbers.  If Builderboy's up for it, then I doubt if there would be much more headaches.  I am fine with the change myself. :)

Offline Builderboy

  • Physics Guru
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 5673
  • Rating: +613/-9
  • Would you kindly?
    • View Profile
Re: Axe Parser
« Reply #228 on: March 13, 2010, 10:11:10 pm »
I would love love love for signed numbers, because yeah, for now i have been doing things like

Code: [Select]
If(A>30000)
-(-A*5)->A
Else
A*5->A
End

to multiply numbers, which is a bit annoying.  It gets even worse for inequalities.  Instead of

Code: [Select]
A<10
You need to do things like

Code: [Select]
A<10 OR (A>65326)
Currently there are glitches in the Portal engine that would be fixed with signed numbers :)

Offline ztrumpet

  • The Rarely Active One
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 5712
  • Rating: +364/-4
  • If you see this, send me a PM. Just for fun.
    • View Profile
Re: Axe Parser
« Reply #229 on: March 13, 2010, 10:13:14 pm »
Code: [Select]
If(A>30000)
-(-A*5)->A
Else
A*5->A
End
Ah, after reading that I finally understand your code now!  ;D

I'm glad you're up for it.  :)
Bring on the signed numbers!  :D
« Last Edit: March 13, 2010, 10:13:28 pm by ztrumpet »

Offline Quigibo

  • The Executioner
  • CoT Emeritus
  • LV11 Super Veteran (Next: 3000)
  • *
  • Posts: 2031
  • Rating: +1075/-24
  • I wish real life had a "Save" and "Load" button...
    • View Profile
Re: Axe Parser
« Reply #230 on: March 13, 2010, 10:22:32 pm »
Unfortunately, it does make slightly larger code and it means you can't use the optimizations anymore, but its still a lot less than what Builderboy has been doing.  You can still use the optimizations with unsigned math though.
___Axe_Parser___
Today the calculator, tomorrow the world!

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: Axe Parser
« Reply #231 on: March 13, 2010, 10:35:14 pm »
btw I had an idea that is not directly related to Axe itself, but more the sprite editor: It would be cool to be able to convert sprites to hex from anywhere on the graph screen because while the editor is good, it can be a bit slow to make sprites. I prefer to edit my graphics in MS Paint or Photofiltre Studio on the computer, or directly on the graph screen. I tried removing the part of the code I would need for that but I couldn't understand most of it since I have trouble reading other people's code.

Or maybe someone else could write this tool?

Offline Quigibo

  • The Executioner
  • CoT Emeritus
  • LV11 Super Veteran (Next: 3000)
  • *
  • Posts: 2031
  • Rating: +1075/-24
  • I wish real life had a "Save" and "Load" button...
    • View Profile
Re: Axe Parser
« Reply #232 on: March 13, 2010, 10:40:22 pm »
I use this when writing asm programs for large pictures:

http://www.ticalc.org/archives/files/fileinfo/134/13415.html

Just set the output to hex.
___Axe_Parser___
Today the calculator, tomorrow the world!

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: Axe Parser
« Reply #233 on: March 13, 2010, 10:45:39 pm »
Mhmm that might work (hoping it does in Windows 7 too :P)

I think I should maybe include this in the downloads section if it does, because it's a nightmare to edit sprites directly in hex x.x

Offline meishe91

  • Super Ninja
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2946
  • Rating: +115/-11
    • View Profile
    • DeviantArt
Re: Axe Parser
« Reply #234 on: March 14, 2010, 12:19:45 am »
So what is this signed and unsigned number system? I'm quite confused.
Spoiler For Spoiler:



For the 51st time, that is not my card! (Magic Joke)

Offline Builderboy

  • Physics Guru
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 5673
  • Rating: +613/-9
  • Would you kindly?
    • View Profile
Re: Axe Parser
« Reply #235 on: March 14, 2010, 12:58:56 am »
Well, in the calculator there are no negative numbers.  Negative signs can't be programed into binary i guess you could say :P This is why its called unsigned.  But, negative numbers are very useful in many ways, so you can sign a number which makes it behave like tis negative, even though it is still represented as a positive number in the calculator.

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: Axe Parser
« Reply #236 on: March 14, 2010, 03:19:41 am »
this page might clear things up:

http://en.wikipedia.org/wiki/Integer_(computer_science)

I have to look at it again all the time because I always forget about each types. x.x Basically, the shorter the integer, the fewer RAM it takes. In z80 assembly you can choose which one to use, altough I don't know if there's a cap. For a RPG, you will want to use 1 byte integers for map coordinates, area ID, LV, ATK, DEF, MAG and SPD, 2 bytes for map ID, HP/MP and damage points, unless these can easily overflow and it's too hard to work around, and 4 byte for other stuff that requires much longer numbers.
« Last Edit: March 14, 2010, 03:23:05 am by DJ Omnimaga »

Offline meishe91

  • Super Ninja
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2946
  • Rating: +115/-11
    • View Profile
    • DeviantArt
Re: Axe Parser
« Reply #237 on: March 14, 2010, 05:26:33 am »
Hmmm ok. Thanks guys. I will have to read that page.
Spoiler For Spoiler:



For the 51st time, that is not my card! (Magic Joke)

Offline calc84maniac

  • eZ80 Guru
  • Coder Of Tomorrow
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2912
  • Rating: +471/-17
    • View Profile
    • TI-Boy CE
Re: Axe Parser
« Reply #238 on: March 14, 2010, 09:12:07 am »
According to that page, multiplication doesn't need to be changed for signed values. I think this is correct, because we are only getting a 16-bit result. So signed multiplication will probably work just fine with the current version of Axe :D

Edit:
Never mind, I was wrong. I think there may be some problem with the current multiplication routine.
« Last Edit: March 14, 2010, 09:41:41 am by calc84maniac »
"Most people ask, 'What does a thing do?' Hackers ask, 'What can I make it do?'" - Pablos Holman

Offline Quigibo

  • The Executioner
  • CoT Emeritus
  • LV11 Super Veteran (Next: 3000)
  • *
  • Posts: 2031
  • Rating: +1075/-24
  • I wish real life had a "Save" and "Load" button...
    • View Profile
Re: Axe Parser
« Reply #239 on: March 15, 2010, 11:30:34 pm »
Hope everyone likes the new update.  Should make a few things a little easier.  I haven't converted to signed numbers yet since I still have a lot more routines to change.  I haven't even tested some of the new commands yet other than trivial examples because I've been busy, but I think they all work.
___Axe_Parser___
Today the calculator, tomorrow the world!