Author Topic: Using the nib{ command [solved] :D  (Read 2994 times)

0 Members and 1 Guest are viewing this topic.

Offline parserp

  • Hero Extraordinaire
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1455
  • Rating: +88/-7
  • The King Has Returned
    • View Profile
Using the nib{ command [solved] :D
« on: January 07, 2012, 02:50:41 pm »
So, If I have a 176 byte tilemap in L1, (a number from 0-15) and I want to have it stored in an appvar, but in 88 bytes using the nib{ command, how would I do that?
...And then to get the information from the appvar and copy it to L1 again?
« Last Edit: January 07, 2012, 03:12:19 pm by parser padwan »

Offline leafy

  • CoT Emeritus
  • LV10 31337 u53r (Next: 2000)
  • *
  • Posts: 1554
  • Rating: +475/-97
  • Seizon senryakuuuu!
    • View Profile
    • keff.me
Re: Using the nib{ command
« Reply #1 on: January 07, 2012, 02:53:03 pm »
Alternatively you could just do something like:

GetCalc(Str01)→V
For(A,0,87)
{A*2+L1→B}*16+{B+1}→{A+V}
End
In-progress: Graviter (...)

Offline parserp

  • Hero Extraordinaire
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1455
  • Rating: +88/-7
  • The King Has Returned
    • View Profile
Re: Using the nib{ command
« Reply #2 on: January 07, 2012, 02:57:01 pm »
Alternatively you could just do something like:

GetCalc(Str01)→V
For(A,0,87)
{A*2+L1→B}*16+{B+1}→{A+V}
End
ah, that makes sense. but how would I decode that?

Offline leafy

  • CoT Emeritus
  • LV10 31337 u53r (Next: 2000)
  • *
  • Posts: 1554
  • Rating: +475/-97
  • Seizon senryakuuuu!
    • View Profile
    • keff.me
Re: Using the nib{ command
« Reply #3 on: January 07, 2012, 02:59:47 pm »
To convert it from nibbles to bytes just do the opposite:

GetCalc(Str01)→V
For(A,0,87)
{A+V}→C/16→{A*2+L1→B}
C^16→{B+1}
End

(Someone correct me if I'm wrong)
« Last Edit: January 07, 2012, 03:00:15 pm by leafiness0 »
In-progress: Graviter (...)

Offline parserp

  • Hero Extraordinaire
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1455
  • Rating: +88/-7
  • The King Has Returned
    • View Profile
Re: Using the nib{ command
« Reply #4 on: January 07, 2012, 03:11:07 pm »
yay it worked! thanks leafy! :D

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: Using the nib{ command [solved] :D
« Reply #5 on: January 07, 2012, 05:57:02 pm »
If you want to use the nib{} command to avoid the unoptimized division and multiplications, you could do it like:
Code: [Select]
GetCalc(Str01)→V
For(A,0,175)
{L1+A}→nib{V*2+A}
End
And to decode, its as simple as reversing the store:
Code: [Select]
GetCalc(Str01)→V
For(A,0,175)
nib{V*2+A}→{L1+A}
End
___Axe_Parser___
Today the calculator, tomorrow the world!