Author Topic: FOR ASM/AXE CODERS: BaseCalc  (Read 14205 times)

0 Members and 1 Guest are viewing this topic.

Offline Deep Toaster

  • So much to do, so much time, so little motivation
  • Administrator
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 8217
  • Rating: +758/-15
    • View Profile
    • ClrHome
FOR ASM/AXE CODERS: BaseCalc
« on: October 13, 2010, 07:51:46 pm »
Long time since I've touched TI-BASIC again (yes, Axe is that addicting ;D). I made a quick program that's becoming really useful for ASM: a program that calculates anything in binary, octal, decimal, hex, or any combination of the four. In other words, type in something like "b10110101+o571-x1E+241" and it'll output the answer as 769. Since it calculates using the expr( command, you can put literally any numerical expression in and it'll solve correctly, including exponents, trig, and other functions. Shot below :)

EDIT: New version uses all uppercase letters. Also, I changed hex to H. In other words, replace b with B, o with O, and x with H.

EDIT2: Even newer version changes it back -- sorry.

http://www.omnimaga.org/index.php?action=downloads;sa=view;down=591
« Last Edit: December 05, 2010, 01:13:10 am by Deep Thought »




SirCmpwn

  • Guest
Re: FOR ASM/AXE CODERS: BaseCalc
« Reply #1 on: October 13, 2010, 07:52:14 pm »
Nice!

Offline Hot_Dog

  • CoT Emeritus
  • LV12 Extreme Poster (Next: 5000)
  • *
  • Posts: 3006
  • Rating: +445/-10
    • View Profile
Re: FOR ASM/AXE CODERS: BaseCalc
« Reply #2 on: October 13, 2010, 07:52:42 pm »
Holy, that's awesome!

Offline Deep Toaster

  • So much to do, so much time, so little motivation
  • Administrator
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 8217
  • Rating: +758/-15
    • View Profile
    • ClrHome
Re: FOR ASM/AXE CODERS: BaseCalc
« Reply #3 on: October 13, 2010, 07:54:10 pm »
And so far, it's a nice, reasonable 295 bytes.

Anyone who finds any optimizations, feel free to post it!




Offline nemo

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1203
  • Rating: +95/-11
    • View Profile
Re: FOR ASM/AXE CODERS: BaseCalc
« Reply #4 on: October 13, 2010, 07:55:05 pm »
does it take into account the base? like if i put in b0012, would it tell me that 2 won't work? or would it just calculate it as 4?


Offline Deep Toaster

  • So much to do, so much time, so little motivation
  • Administrator
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 8217
  • Rating: +758/-15
    • View Profile
    • ClrHome
Re: FOR ASM/AXE CODERS: BaseCalc
« Reply #5 on: October 13, 2010, 08:10:44 pm »
does it take into account the base? like if i put in b0012, would it tell me that 2 won't work? or would it just calculate it as 4?

It would actually calculate it as 22. Kinda weird, but let me explain:

All the program does is convert numbers of other bases to decimal for the OS to resolve. It uses a While loop for each number to detect when the number ends. In this case, the program knows that the number ends at that 2. So it inserts 2 into the final equation instead of b001, and it becomes 22.

I'm probably gonna change this. I've already decided what I'm going to do: I'm going to add parentheses around the number to be inserted, so that it becomes b0012=(b001)2=(2)2=4.




Offline nemo

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1203
  • Rating: +95/-11
    • View Profile
Re: FOR ASM/AXE CODERS: BaseCalc
« Reply #6 on: October 13, 2010, 08:18:00 pm »
but what if the user mistypes b0011 into b0012? you mean your program will just convert this into 2*b001? then that begs the question, what if you have a string like b10201012? wouldn't your program mark it as 2*(b10) + 1012? i'd suggest getting the program to recognize that the given amount exceeds that of the maximum number possible, and then telling the user. regardless, it's a great program if you put in what you meant to (:


Offline Deep Toaster

  • So much to do, so much time, so little motivation
  • Administrator
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 8217
  • Rating: +758/-15
    • View Profile
    • ClrHome
Re: FOR ASM/AXE CODERS: BaseCalc
« Reply #7 on: October 13, 2010, 08:19:36 pm »
Hmm, good point. It would add ~50 bytes and make each pass a lot slower, though :(

Anyway, story behind the program:

It was horrible.

I'd made a program that I thought was brilliant (or at least very, very useful ;D). I wanted to share it on Omni, but (1) I lost my link cable; (2) WabbitEmu's Export feature was broken; and (3) SourceCoder still had bugs, which gave the program random syntax errors.

So I made the program with SourceCoder and started debugging it with Wabbit. Then I realized that even if I fixed it, I couldn't export it. So I opened up a hex editor (yes, on the comp, and yes, I'm suicidal, apparently). And so I began the task of individually editing hex codes to make it work.

That's when I got BSoD'd. It was horrible.
« Last Edit: October 14, 2010, 09:26:57 am by Deep Thought »




Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55942
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: FOR ASM/AXE CODERS: BaseCalc
« Reply #8 on: October 13, 2010, 11:43:35 pm »
Nice utility!
Now active at https://discord.gg/cuZcfcF (CodeWalrus server)

Offline Deep Toaster

  • So much to do, so much time, so little motivation
  • Administrator
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 8217
  • Rating: +758/-15
    • View Profile
    • ClrHome
Re: FOR ASM/AXE CODERS: BaseCalc
« Reply #9 on: October 13, 2010, 11:46:30 pm »
Thanks, and I just realized something: It works almost the same way as Calcalca. Maybe I could combine them...




Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55942
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: FOR ASM/AXE CODERS: BaseCalc
« Reply #10 on: October 13, 2010, 11:55:38 pm »
Mhmm idk. Calcalca is more math-oriented. Programmers might prefer to just have the base conversion to save as much space as possible. In my case I haven't needed math programs since the last time I had maths was 7 years ago ;D
Now active at https://discord.gg/cuZcfcF (CodeWalrus server)

Offline Deep Toaster

  • So much to do, so much time, so little motivation
  • Administrator
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 8217
  • Rating: +758/-15
    • View Profile
    • ClrHome
Re: FOR ASM/AXE CODERS: BaseCalc
« Reply #11 on: October 13, 2010, 11:59:35 pm »
Good point. Well, I'll change it a bit, add a readme, and hopefully release this tomorrow :)




Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55942
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: FOR ASM/AXE CODERS: BaseCalc
« Reply #12 on: October 14, 2010, 12:01:21 am »
Ok. Feel free to upload in the dl section :D
Now active at https://discord.gg/cuZcfcF (CodeWalrus server)

Offline Deep Toaster

  • So much to do, so much time, so little motivation
  • Administrator
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 8217
  • Rating: +758/-15
    • View Profile
    • ClrHome
Re: FOR ASM/AXE CODERS: BaseCalc
« Reply #13 on: October 14, 2010, 12:03:15 am »
A question: Would people rather use lowercase letters for binary, octal, and hex at the cost of having an extra ASM sub, or just use uppercase?
« Last Edit: October 14, 2010, 12:17:23 am by Deep Thought »




Offline Builderboy

  • Physics Guru
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 5673
  • Rating: +613/-9
  • Would you kindly?
    • View Profile
Re: FOR ASM/AXE CODERS: BaseCalc
« Reply #14 on: October 14, 2010, 12:56:00 am »
Uppercase most deffinetaly, i can never keep my lowercase on, even with multiple apps that enable it on my calc.