This is an archived, read-only copy of the United-TI subforum , including posts and topic from May 2003 to April 2012. If you would like to discuss any of the topics in this forum, you can visit Cemetech's z80 & ez80 Assembly subforum. Some of these topics may also be directly-linked to active Cemetech topics. If you are a Cemetech member with a linked United-TI account, you can link United-TI topics here with your current Cemetech topics.

This forum is locked: you cannot post, reply to, or edit topics. Z80 & 68k Assembly => z80 & ez80 Assembly
Author Message
philos


Newbie


Joined: 12 Nov 2010
Posts: 3

Posted: 12 Nov 2010 09:08:53 am    Post subject:

First of all, sorry if this is some kind of repost but I honestly have been looking for an answer for over a week and have found nothing about this so far. Also when I did a search about arguments, didn't see anything that would answer my question.

So, my question is, since some compilers like sdcc and zdk88 compile c language files into z80 assembly files, which run in TI calculators, is there any kind of support for arguments?

My goal is to create programs so that I can call them in my TI-84+ SE as a function ("program(arg1,arg2,arg3...)").

Is this possible? If so, how do I have to write my main function? I've tried using regular ansi c "int main(int argc, char** argv)" but the compiler (SDCC) didn't recognize this.

Thanks in advance
Back to top
Xeda112358


Active Member


Joined: 19 May 2009
Posts: 520

Posted: 12 Nov 2010 05:54:18 pm    Post subject:

What you need to do is learn how to use the Parser Hook. You will need to make an app or store the data to a place like AppBackUpScreen, but you can use the hook that way. You might be able to execute a specific program from a hook, I am not sure.
Back to top
calc84maniac


Elite


Joined: 22 Jan 2007
Posts: 770

Posted: 12 Nov 2010 06:20:34 pm    Post subject:

There is probably no support for arguments. It might be easier to read arguments from TI-Basic variables (which is what most ASM programs that expect arguments do)
Back to top
philos


Newbie


Joined: 12 Nov 2010
Posts: 3

Posted: 12 Nov 2010 08:09:50 pm    Post subject:

calc84maniac wrote:

There is probably no support for arguments. It might be easier to read arguments from TI-Basic variables (which is what most ASM programs that expect arguments do)

Easier it is. At least because it's not hard to find out how to do that (simple i/o) Laughing . But if I were able to call a program like a built-in TI-84+ function, it would really speed up most of the calculations I need to do (I wouldn't have to lose time waiting for the calculator to ask me for the arguments).

I'm gonna check out what Parser Hook is, but I'm starting to lose hope in this :|

Btw, thank you for the answers.
Back to top
magicdanw
pcGuru()


Calc Guru


Joined: 14 Feb 2007
Posts: 1110

Posted: 18 Nov 2010 01:18:04 am    Post subject:

You don't need to ask the user to input the arguments - you would have the assembly program look up BASIC variables and read the arguments from there. The user, or the calling program, would have to set those variables up beforehand.

The reason you can't really do arguments is because the BASIC parser doesn't let you push things onto the stack when calling a program. You might be able to do something with a parser hook that would intercept running a program, read the arguments following the program name, push them to the stack, and then run the program... I thought about trying to do something along those lines way back when, but then I went to college and lost all my free time for calculator development :(

Really, I don't think there is a huge need for this kind of thing, since arguments don't add any extra functionality to BASIC programs without having local variables (another thing I tried to find a scheme to implement with but abandoned very quickly), and they don't add much functionality at all to assembly programs.
Back to top
philos


Newbie


Joined: 12 Nov 2010
Posts: 3

Posted: 18 Nov 2010 05:50:22 am    Post subject:

magicdanw wrote:

(...) they don't add much functionality at all to assembly programs.


Although I clearly won't argue with someone that obviously knows a lot more about z80 ASM than me, I have to say that I don't understand why you say arguments wouldn't add functionality to assembly programs. As I stated before, my goal is to be able to call my programs like they were built-in calculator functions (like 'add(1,2)'), without having the program ask me for the data. I can't imagine BASIC doing that, but I can imagine assembly doing it, specially when compilers "work" with ANSI C.

Please explain me your point of view.
Back to top
calc84maniac


Elite


Joined: 22 Jan 2007
Posts: 770

Posted: 18 Nov 2010 11:01:38 am    Post subject:

One way to implement what you are talking about (though less "pretty") is {1,2}:Asm(prgmADD). Your program should look up the Ans variable and parse the data in the list.
Back to top
Display posts from previous:   
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
    »
» View previous topic :: View next topic  
Page 1 of 1 » All times are UTC - 5 Hours

 

Advertisement