Omnimaga

Calculator Community => TI Calculators => Axe => Topic started by: BlackCode on September 22, 2013, 11:57:42 am

Title: Basic in Axe
Post by: BlackCode on September 22, 2013, 11:57:42 am
I feel like this should be incredibly easy, but experimentation has not given me any help.  Obviously its easy to execute an Axe program from within Basic, but how can the process be reversed?  Essentially I'd like to use the simpler data handling of basic for a portion of my program.
Title: Re: Basic in Axe
Post by: nikitouzz on September 22, 2013, 12:10:42 pm
yes you can but it's more complicated...
Title: Re: Basic in Axe
Post by: BlackCode on September 22, 2013, 12:14:19 pm
Obviously its more complicated if I couldn't figure it out as easily as calling Axe from within Basic.  Would you mind explaining it, or pointing me to a source that does explain it?
Title: Re: Basic in Axe
Post by: Streetwalrus on September 22, 2013, 12:29:34 pm
I don't know how to do it but I'm sure the awesome asm coders out there do know. ;)
Title: Re: Basic in Axe
Post by: BlackCode on September 22, 2013, 01:01:03 pm
So...should I ask again somewhere else?  Or will somebody see this?
Title: Re: Basic in Axe
Post by: Streetwalrus on September 22, 2013, 01:04:13 pm
Well, if others are like me, they check the new posts page pretty often so yes.
Title: Re: Basic in Axe
Post by: BlackCode on September 22, 2013, 01:09:21 pm
Alright, I'll wait and hope someone more knowledgeable has a solution...Otherwise program structure will be a pain...
Title: Re: Basic in Axe
Post by: dinosteven on September 22, 2013, 01:53:28 pm
It's been an hour lol... One of the Axe/ASM gurus (Runner) will likely find this within a day.
Title: Re: Basic in Axe
Post by: willrandship on September 22, 2013, 01:55:57 pm
It will take some Asm( commands, that's for sure. Also, you'll have to make sure you're in the right modes, etc.

An easier solution would be to have the BASIC programs do all the launching. Write a small wrapper around your axe programs, and use GetCalc (see commands.html) to store OS vars in axe you can use for flow control.
Title: Re: Basic in Axe
Post by: Soulthym on September 22, 2013, 01:56:58 pm
I know an asm code that lauch a program with its adress of the name put in hl:
Code: [Select]
"prgmNAME"->Str1
Str1
Asm(E7FDCB08CEEF9B4AFDCB088E)
I'm not sure so try it on an emulator first
Title: Re: Basic in Axe
Post by: willrandship on September 22, 2013, 01:59:41 pm
And there you have it!

My concern would be, does it return to the Axe program correctly or does it just die once it finishes?
Title: Re: Basic in Axe
Post by: Soulthym on September 22, 2013, 02:04:16 pm
If I remember right, ues it does return to the axe program, I used it for an input command ;p
Title: Re: Basic in Axe
Post by: shmibs on September 22, 2013, 02:06:01 pm
before you start doing something messy like this, what exactly is the problem you're trying to get around that you think will be easier to manage in basic than in axe?
Title: Re: Basic in Axe
Post by: Streetwalrus on September 22, 2013, 02:08:28 pm
Oh yeah I tried it and it works well.
Title: Re: Basic in Axe
Post by: Hayleia on September 22, 2013, 02:15:26 pm
(Also, sometimes it is good to look on the forums (http://ourl.ca/9465) before making a new topic, or try Googling a bit (second link when typing "run basic progs in axe"))
Title: Re: Basic in Axe
Post by: BlackCode on September 22, 2013, 05:27:46 pm
(Also, sometimes it is good to look on the forums (http://ourl.ca/9465) before making a new topic, or try Googling a bit (second link when typing "run basic progs in axe"))

In my defense (not that I'm justifying it or anything), neither forum searches nor googling turned up the results I wanted.  In fact, most of what I got was requests on translating Basic code into Axe.  Shmibs, I'm basically trying to create a string, based on user input, that can later be recalled by the user.  Since Axe support for this is...lacking...I figured Basic would be much simpler to implement.
Title: Re: Re: Basic in Axe
Post by: DJ Omnimaga on September 22, 2013, 06:41:56 pm
Actually Google worked for me before, but I noticed that it had been getting worse at finding relevant results lately. Sometimes I use Bing instead.

It is nowhere as horrible as DuckDuckGo and to a lesser extent the revived forum search (which can be decent if you know how to get around its quirks)
Title: Re: Basic in Axe
Post by: shmibs on September 22, 2013, 06:47:24 pm
an os string to be recalled outside the program? that's a simple problem that's been solved several times now. it's much simpler to handle it in Axe than it would be to launch a basic program and pass things back and forth. check out this external variables tutorial (http://ourl.ca/8294) that Finale wrote a while ago for a quick overview. if you have any more questions, feel free to ask =).

and dj, the site search is working again and gave lots of relevant info for me when i used it just now =)
Title: Re: Basic in Axe
Post by: BlackCode on September 22, 2013, 07:30:29 pm
I wasn't clear.  By recall, I mean 2nd+STO, as in, RCL.  I want to be able to do RCL Str(whatever I use) and have it paste it.  Its a helping program like HexSprite.  Hope that clears it up a bit.
Title: Re: Basic in Axe
Post by: shmibs on September 22, 2013, 07:44:04 pm
yes, that's what i thought you meant. you can create an OS string variable and store text into it fairly easy from within Axe using the method i linked to. if you do it right, it will be just like any other os string which you can recall that way.
Title: Re: Basic in Axe
Post by: BlackCode on September 22, 2013, 08:23:25 pm
Something isn't clicking for me.  Could you provide a quick example of a program that would store some text into a string?  My current attempts don't seem to actually be doing anything, despite compiling and running fine.
Title: Re: Basic in Axe
Post by: DJ Omnimaga on September 22, 2013, 08:32:55 pm

and dj, the site search is working again and gave lots of relevant info for me when i used it just now =)
Yeah, hence why I said it works well when you know how to get around its quirks (basically, searching from board index rather than from a sub-forum)
Title: Re: Basic in Axe
Post by: Runer112 on September 22, 2013, 08:38:47 pm
IMPORTANT PREFACE: Strings used by the OS are all strings of tokens, not characters. This means that my first example below would not work if I used "Hello", because although the 'H' character and token codes are the same (all letters, numbers, and some symbols have this characteristic), lowercase letters are two-byte tokens and not equal to their one-byte character codes.


Now that that's out of the way, here's a quick example of how you could store the string "HELLO" to Ans:

Code: [Select]
Copy("HELLO",GetCalc([04720000],5),5)


And here's a slightly less simple example I made for fun that would convert an 8x8 sprite pointed to by S into a hex string in Str0:

Code: [Select]
If GetCalc("Str0",16)
 →O
 S
 For(8)
  Select(,{{}►Hex+2}ʳ→{O}ʳ+1→O)+1
 End
End
Title: Re: Basic in Axe
Post by: BlackCode on September 22, 2013, 09:21:05 pm
How would I make it work if I were to use lowercase then?  And how would this work for recalling, will it not just be displayed as numbers (or whatever), or are tokens interpreted differently?

Edit:  Also, I was under the impression that strings in Axe were static and determined at compile time.  Unless hacked strings (which the tutorial doesn't have) get around this(?) I don't see how this would help...