• Axe Q&A 5 5
Currently:  

Author Topic: Axe Q&A  (Read 600103 times)

0 Members and 4 Guests are viewing this topic.

Offline NikProgrammer

  • LV3 Member (Next: 100)
  • ***
  • Posts: 50
  • Rating: +0/-0
  • Calc's are the most handy thing ever invented :D
    • View Profile
Re: Axe Q&A
« Reply #1785 on: May 06, 2014, 11:49:20 am »
I really don't have the program anymore... Sorry...

And I just remember it didn't work, but not the line or something like that.



Can I use the BASIC Tools (Download form Ti-calc.org)library if I have installed Axe?
« Last Edit: May 07, 2014, 08:24:18 am by NikProgrammer »
Well, I'm not english or american so if anything posted by me is not correct just say or ignore...
And please don't set me back because I live in germay... Though I speak german I am still from UA!
––––––––––––––––––––––––––––––––––––––––––––––––––––
It may sound weird but:
'The teapot cools down long.'
and
'The teapot does not cool down long.'
means the same.

What for do we live? - To think of why we do live.
––––––––––––––––––––––––––––––––––––––––––––––––––––
Loving chess- If you know any good chess programs for TI-83+ please PM me- thanks!
Working on Remakes for all of my programs to optimize them and add more user friendliness... And most important: Graphics. I'm not good at graphics, every help is welcome... -Please PM too.

Offline ordelore

  • LV4 Regular (Next: 200)
  • ****
  • Posts: 168
  • Rating: +7/-0
  • Genius and Friend
    • View Profile
    • ordelore8x
Re: Axe Q&A
« Reply #1786 on: June 16, 2014, 06:49:07 pm »
How could I extract the beginning part of a string?
eg: Str1="PTR 8,5"
I want to know that the first three characters are PTR.
I am a friend.
I mine Bitcoins.

Offline Matrefeytontias

  • Axe roxxor (kinda)
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1982
  • Rating: +310/-12
  • Axe roxxor
    • View Profile
    • RMV Pixel Engineers
Re: Axe Q&A
« Reply #1787 on: June 16, 2014, 06:57:32 pm »
There's a command for that. See the Miscellaneous part of commands.html.

Offline Runer112

  • Project Author
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2289
  • Rating: +639/-31
    • View Profile
Re: Axe Q&A
« Reply #1788 on: June 16, 2014, 08:59:36 pm »
Do you actually need to extract the first three characters as a substring, or are you merely interested in checking if it starts with a specific three-character-long string?



If it's the latter, Matrefeytontias is partially correct in suggesting that there's a command for that. The Equ►String() command checks if two strings passed as arguments are equal, returning zero if so and nonzero otherwise. The reason why he's only partially correct is because, as you can see from that description, the command isn't made to check if one string starts with another. But if you're comfortable using the technically undefined return value when the strings aren't equal, you can check this. With the current implementation, when the two strings differ, the return value is actually a pointer to the first character in the second string that differs from the character at the same position in the first string. So the following code would work to check if a string starts with "PTR", but isn't guaranteed to work in future versions of Axe:

Code: [Select]
"PTR"→Str0
!If Equ►String(<string>,Str0)?-3-Str0
.Starts with "PTR"
End

For reference, the second line is an optimized version of:
If (Equ►String(<string>,Str0)=0) or (Equ►String(<string>, Str0)=(Str0+3)).



If it's the former, extracting a substring of predetermined length is somewhat straightforward, despite Axe lacking a built-in substring command. Extracting a substring simply comes down to copying the characters you want to a new area of memory and making sure the new substring data ends with a null terminator byte. So to extract a 3-byte substring from the front of a string, you'd need to reserve 4 bytes of memory and copy it, perhaps like this:

Code: [Select]
Copy(<string>,L₁,3)
0→{L₁+3}
.Substring at L₁

Spoiler For More information about statically allocating/reserving memory:
There are three primary options:
  • Allocate the buffer inside the program with something like Buff(256)→Str0. Note that this will not work if you compile your code as an application, and that Buff( is really the det( token renamed.
  • Allocate the buffer externally by using a free static RAM reference like L1 in place of Str0, or make Str0 refer to the reference, like L1→Str0. As long as you can find the free RAM space for it, this is generally the preferred option. Note that you do not perform any active allocation; the "allocation" simply entails making a note that nothing else should be trying to use that area of RAM at the same time.
  • Allocate the buffer externally by asking the OS to allocate space for the buffer at runtime, like GetCalc("tmpBUF",256)→S. Note that since this is allocated at runtime, you have to save the reference in a variable instead of a static pointer like Str0. This may also fail if the space cannot be allocated due to not having enough free user RAM (in which case S will be zero), a problem which does not affect the other two options. tmp is really the w token (2nd+9), added in Axe 1.2.0, which results in the variable automatically being deleted when your program finishes.
« Last Edit: June 16, 2014, 09:01:25 pm by Runer112 »

Offline TheMachine02

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 452
  • Rating: +105/-0
  • me = EF99+F41A
    • View Profile
Re: Axe Q&A
« Reply #1789 on: July 02, 2014, 11:36:23 am »
Does any axe command make use of the asm_flag at iy+33 ? I was wondering that, cause I want to use a flag field in an axiom, and it is the simpler way to do so.

EDIT : Streetwalrus answered to my question  :D

EDIT by Runer112: To clarify, the answer was no.
« Last Edit: July 02, 2014, 12:36:25 pm by Runer112 »

Offline Hayleia

  • Programming Absol
  • Coder Of Tomorrow
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3367
  • Rating: +393/-7
    • View Profile
Re: Axe Q&A
« Reply #1790 on: July 09, 2014, 02:31:42 am »
I don't know if I already asked but when I went through some pages of that topic, I didn't find that question so I guess I didn't ask ?

Would it be possible to have less syntax restrictions ? Example:
Copy(L6,Copy(L3,L6,96),192)

This example is something stupid I just coined but you get the idea.
This is currently impossible to write, "Cannot use here". But what if that's what I want to write and I know what I am doing ? Because I can understand that beginners could get problems writing this kind of stuff, but they would not write that kind of stuff so those restrictions are only annoying non-beginners.
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 aeTIos

  • Nonbinary computing specialist
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3915
  • Rating: +184/-32
    • View Profile
    • wank.party
Re: Axe Q&A
« Reply #1791 on: July 09, 2014, 02:35:16 am »
Do I see some screen scrolling code? :P
I'm not a nerd but I pretend:

Offline Hayleia

  • Programming Absol
  • Coder Of Tomorrow
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3367
  • Rating: +393/-7
    • View Profile
Re: Axe Q&A
« Reply #1792 on: July 09, 2014, 02:37:38 am »
If that's screen scrolling code, I didn't make it on purpose. But I don't think it is (or at least, if it's partially, it's not complete).
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 aeTIos

  • Nonbinary computing specialist
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3915
  • Rating: +184/-32
    • View Profile
    • wank.party
Re: Axe Q&A
« Reply #1793 on: July 09, 2014, 02:38:30 am »
I just realized. I don't know why I thought that :P
I'm not a nerd but I pretend:

Offline ClrDraw

  • LV7 Elite (Next: 700)
  • *******
  • Posts: 627
  • Rating: +61/-2
    • View Profile
    • GitHub
Re: Axe Q&A
« Reply #1794 on: September 29, 2014, 12:39:20 pm »
Is there any way to garbage collect in axe? My current program has to archive programs a lot and I want it to automatically garbage collect when necessary (like DoorsCS does).


Also, is there a way to change the size of a program without creating a new program and copying the old?


Thank in advance for your help  :)
« Last Edit: September 29, 2014, 12:46:15 pm by ClrDraw »
Visit my GitHub for all my TI programs as well as other projects.
Also check out my website.

Offline Hayleia

  • Programming Absol
  • Coder Of Tomorrow
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3367
  • Rating: +393/-7
    • View Profile
Re: Axe Q&A
« Reply #1795 on: September 29, 2014, 02:56:52 pm »
Is there any way to garbage collect in axe? My current program has to archive programs a lot and I want it to automatically garbage collect when necessary (like DoorsCS does).
I think this is done automatically in the "Archive" command. When necessary, the "GarbageCollect ? Yes/No" menu appears. I am not sure though but I think.

Also, is there a way to change the size of a program without creating a new program and copying the old?
This can be done with MEMKIT (included in the zip) if your program is unarchived.
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 ClrDraw

  • LV7 Elite (Next: 700)
  • *******
  • Posts: 627
  • Rating: +61/-2
    • View Profile
    • GitHub
Re: Axe Q&A
« Reply #1796 on: September 29, 2014, 09:54:52 pm »
I think this is done automatically in the "Archive" command. When necessary, the "GarbageCollect ? Yes/No" menu appears. I am not sure though but I think.
It brings up the menu. I want a way to skip the menu (because it messes up if the user clicks no) and garbage collect on its own :/

This can be done with MEMKIT (included in the zip) if your program is unarchived.
Hmm, I guess no way if its archived then?
« Last Edit: October 01, 2014, 10:53:07 am by Runer112 »
Visit my GitHub for all my TI programs as well as other projects.
Also check out my website.

Offline ClrDraw

  • LV7 Elite (Next: 700)
  • *******
  • Posts: 627
  • Rating: +61/-2
    • View Profile
    • GitHub
Re: Axe Q&A
« Reply #1797 on: October 01, 2014, 09:30:22 am »
Bump.
Anybody know? This is the only thing holding up my project.
Visit my GitHub for all my TI programs as well as other projects.
Also check out my website.

Offline Matrefeytontias

  • Axe roxxor (kinda)
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1982
  • Rating: +310/-12
  • Axe roxxor
    • View Profile
    • RMV Pixel Engineers
Re: Axe Q&A
« Reply #1798 on: October 01, 2014, 10:22:11 am »
It's not possible unless you use ASM. And even so, I don't know how you could do it ; you should ask KermM.

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 Q&A
« Reply #1799 on: October 01, 2014, 10:38:12 am »
Couldn't you just keep your programs in archive then copy them over to RAM or read them directly? Or is that impossible in Axe too?


Garbage collecting every minute is bad anyway (although in some cases there is no other alternative) because the battery bill gets ridiculous.