Author Topic: Text compression for AXE programs  (Read 6782 times)

0 Members and 1 Guest are viewing this topic.

Offline gtaforever00

  • LV1 Newcomer (Next: 20)
  • *
  • Posts: 10
  • Rating: +4/-0
    • View Profile
Text compression for AXE programs
« on: October 30, 2011, 08:32:36 pm »
Well I have just been getting a hang of the AXE language and decided my first project is going to be some kind of text compression for my future projects.  I was thinking if you use A thru Z, <space>, <period>, <question mark>, <comma>, <single quote>, <colon>.  That is 32 characters altogether.  You can use 5 bits instead of the 8 bits and therefore saving about 35% space.  If you had 500 characters (500 bytes) and use this theory your total memory usage would be approximately 313 bytes.   What does everybody think?  Would this benefit anybody in their current projects or future ones?  Input would be appreciated thanks.

Offline epic7

  • Chopin!
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2200
  • Rating: +135/-8
  • I like robots
    • View Profile
Re: Text compression for AXE programs
« Reply #1 on: October 30, 2011, 09:12:44 pm »
That would be useful.

Offline Hayleia

  • Programming Absol
  • Coder Of Tomorrow
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3367
  • Rating: +393/-7
    • View Profile
Re: Text compression for AXE programs
« Reply #2 on: October 31, 2011, 04:00:56 am »
I was thinking if you use A thru Z, <space>, <period>, <question mark>, <comma>, <single quote>, <colon>.  That is 32 characters altogether.  You can use 5 bits instead of the 8 bits and therefore saving about 35% space.
You forgot something: There is not only A,B,C,... but also a,b,c,... ;)
But yeah, that would be very useful :D (don't forget the decompression algorithm :P)
I own: 83+ ; 84+SE ; 76.fr ; CX CAS ; Prizm ; 84+CSE
Sorry if I answer with something that seems unrelated, English is not my primary language and I might not have understood well. Sorry if I make English mistakes too.

click here to know where you got your last +1s

Offline AngelFish

  • Is this my custom title?
  • Administrator
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3242
  • Rating: +270/-27
  • I'm a Fishbot
    • View Profile
Re: Text compression for AXE programs
« Reply #3 on: October 31, 2011, 04:21:54 am »
a,b, and c are two byte tokens on-calc. They aren't represented the same as normal ASCII.
∂²Ψ    -(2m(V(x)-E)Ψ
---  = -------------
∂x²        ℏ²Ψ

Offline gtaforever00

  • LV1 Newcomer (Next: 20)
  • *
  • Posts: 10
  • Rating: +4/-0
    • View Profile
Re: Text compression for AXE programs
« Reply #4 on: October 31, 2011, 09:40:01 am »
Well I was also thinking about the lowercase letters, but in reality they just look good and take up more space *.*.  I might implement later another version that does more characters if there is enough support, but it will also be less compression too.  I have almost got the compression engine finished :thumbsup:.  It looks pretty solid  :banghead:,  I have not had too many bugs in it that were not easily fixable.   Axe is definitilely easier to program in if you look at it like assembly code in a sense but with syntax like basic.

Offline gtaforever00

  • LV1 Newcomer (Next: 20)
  • *
  • Posts: 10
  • Rating: +4/-0
    • View Profile
Re: Text compression for AXE programs
« Reply #5 on: October 31, 2011, 01:06:58 pm »
Well update to the project.  The input for the program is the TI-OS Str1 and the output is Str2.  In the demo program the input string is 162 bytes and the output is 108 bytes.  That is about 33% compression with the strings.  Imagine working on a RPG with 2500 bytes of text,  you compress it 33% that is ~1675 bytes.  Nearly a 1000 bytes less than the original now that is pretty impressive.    I will probably have it store the data as hexadecimal in Str2 for convience.  Any suggestions will be considered.

Offline Builderboy

  • Physics Guru
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 5673
  • Rating: +613/-9
  • Would you kindly?
    • View Profile
Re: Text compression for AXE programs
« Reply #6 on: October 31, 2011, 02:20:25 pm »
a,b, and c are two byte tokens on-calc. They aren't represented the same as normal ASCII.

Yes they are, because we are talking about character codes, not tokens.  The ASCII chart that the calc uses has 256 characters that are each 1 space long.  Each can be referenced by a single byte number, using the Axe command >Char. 

Offline FinaleTI

  • Believe in the pony that believes in you!
  • CoT Emeritus
  • LV10 31337 u53r (Next: 2000)
  • *
  • Posts: 1830
  • Rating: +121/-2
  • Believe in the pony that believes in you!
    • View Profile
    • dmuckerman.tumblr.com
Re: Text compression for AXE programs
« Reply #7 on: October 31, 2011, 02:48:41 pm »
This sounds neat! I could possibly use this for Nostalgia, as I only use uppercase letters.


Spoiler For Projects:

My projects haven't been worked on in a while, so they're all on hiatus for the time being. I do hope to eventually return to them in some form or another...

Spoiler For Pokemon TI:
Axe port of Pokemon Red/Blue to the 83+/84+ family. On hold.

Spoiler For Nostalgia:
My big personal project, an original RPG about dimensional travel and a few heroes tasked with saving the world.
Coding-wise, on hold, but I am re-working the story.

Spoiler For Finale's Super Insane Tunnel Pack of Doom:
I will be combining Blur and Collision Course into a single gamepack. On hold.

Spoiler For Nostalgia Origins: Sky's Story:
Prequel to Nostalgia. On hold, especially while the story is re-worked.

Offline C0deH4cker

  • LV5 Advanced (Next: 300)
  • *****
  • Posts: 258
  • Rating: +11/-1
    • View Profile
    • iNinjas Forum/Repo
Re: Text compression for AXE programs
« Reply #8 on: October 31, 2011, 03:00:26 pm »
Looks interesting... I have a project that could benefit from this...

Offline Hayleia

  • Programming Absol
  • Coder Of Tomorrow
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3367
  • Rating: +393/-7
    • View Profile
Re: Text compression for AXE programs
« Reply #9 on: October 31, 2011, 03:38:19 pm »
That is about 33% compression with the strings.
O.O

Any suggestions will be considered.
Please, please, please add lowercase <insert begging smiley here>
In my game, I have more than 1900 bytes of text data. You compression would save a lot of space.
« Last Edit: October 31, 2011, 03:38:31 pm by Hayleia »
I own: 83+ ; 84+SE ; 76.fr ; CX CAS ; Prizm ; 84+CSE
Sorry if I answer with something that seems unrelated, English is not my primary language and I might not have understood well. Sorry if I make English mistakes too.

click here to know where you got your last +1s

Offline parserp

  • Hero Extraordinaire
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1455
  • Rating: +88/-7
  • The King Has Returned
    • View Profile
Re: Text compression for AXE programs
« Reply #10 on: October 31, 2011, 04:47:47 pm »
This is way cool!!!
and yes please do include lowercase. <insert puppy dog eyes> :P

Offline gtaforever00

  • LV1 Newcomer (Next: 20)
  • *
  • Posts: 10
  • Rating: +4/-0
    • View Profile
Re: Text compression for AXE programs
« Reply #11 on: October 31, 2011, 05:25:08 pm »
Ok i'll see what I can do with the lowercase letters.  Another thing,  what about numbers?  With my current routine and plans on the lowercase,  I can only have about 64 characters.  I could take out some of the symbols if numbers was needed.

Offline parserp

  • Hero Extraordinaire
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1455
  • Rating: +88/-7
  • The King Has Returned
    • View Profile
Re: Text compression for AXE programs
« Reply #12 on: October 31, 2011, 05:29:22 pm »
what do you mean by symbols?

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: Text compression for AXE programs
« Reply #13 on: October 31, 2011, 05:52:54 pm »
Another idea, during decompression, you can automatically make the first letter of every sentence uppercase, and the rest lowercase. That way it still looks nice, but it takes up the same amount of space.  You can use other rules too to capitalize things in quotes.  Also, don't forget about characters '0' through '9', those are probably important too.
___Axe_Parser___
Today the calculator, tomorrow the world!

Offline Hayleia

  • Programming Absol
  • Coder Of Tomorrow
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3367
  • Rating: +393/-7
    • View Profile
Re: Text compression for AXE programs
« Reply #14 on: November 01, 2011, 03:31:07 am »
Ok i'll see what I can do with the lowercase letters.  Another thing,  what about numbers?  With my current routine and plans on the lowercase,  I can only have about 64 characters.  I could take out some of the symbols if numbers was needed.
Personally, I use numbers 1,2,3,4 and symbols !?.,-':
I think that is all. But yeah, I am not alone in this planet, so do what you think is fair :P

Another idea, during decompression, you can automatically make the first letter of every sentence uppercase, and the rest lowercase. That way it still looks nice, but it takes up the same amount of space.  You can use other rules too to capitalize things in quotes.  Also, don't forget about characters '0' through '9', those are probably important too.
But if we want to display "Hi Ginny !", then Ginny will be with lowercase D:
But yeah, that would save space.
I own: 83+ ; 84+SE ; 76.fr ; CX CAS ; Prizm ; 84+CSE
Sorry if I answer with something that seems unrelated, English is not my primary language and I might not have understood well. Sorry if I make English mistakes too.

click here to know where you got your last +1s