If I remember correctly, DCS unarchives a Basic program before running it then rearchives it after it finishes, just in case it calls itself. I have an idea how to avoid that:

1- Create new program with same name and size
2- Copy data from archive into program
3- Insert VAT entry at the beginning of the program/list VAT. Then when it calls itself, it will work.
4- Delete duplicate program.

Do you think that would work?
May I direct your attention to this?
http://www.cemetech.net/news.php?252

Short answer: I solved this a beta or two ago. Smile
Well, I guess running archived recursive programs won't work, then.
Sure it does! All it needs is this at the beginning:


Code:
::DCS
:iconhereetcduh
::A
:SUBPROG1
:SUBPROG2
::
:Disp "","PROGRAM CODE HERE
:Output(1,1,"ETC
So would this work?

Code:
PROGRAM:MYPRGM
::DCS
:iconblahblah
::A
:MYPRGM
::
:codeblahblah
:prgmMYPRGM
:codeblahblah
Indeed 'twould. It would work if both were in RAM, both archived, one archived and the other in RAM, and the first in RAM and the second archived. It can deal with any possible combination.
Both? I'm talking about recursive, where a program calls itself, not a separate subroutine.
Just try it several different ways and find out - that would have taken less time than trying to get an answer from here Laughing
Just run the program normally - you don't need the extra part of the header. Doors CS unarchives it before running, and it stays unarchived until it returns control back to DCS, so you can do recursive programming without a hitch.
I thought it gets copied to Ztmp... Confused
Not if it's unarchived. Why would it bother copying an unarchived program from RAM to RAM? That would limit program size at about 11 or 12k, which wouldn't be fair at all.
KermMartian wrote:
Not if it's unarchived. Why would it bother copying an unarchived program from RAM to RAM? That would limit program size at about 11 or 12k, which wouldn't be fair at all.


But I believe the question is what would happen if it was ARCHIVED Razz
For an archived program, it's copied to the program named with the substring of "dcsasmex" that matches the namelength of the original program.
KermMartian wrote:
For an archived program, it's copied to the program named with the substring of "dcsasmex" that matches the namelength of the original program.


Yes, so how would you have a recursive call to an archived program? Too bad there's no prgmTHIS in TI-BASIC Laughing
Kllrnohj wrote:
KermMartian wrote:
For an archived program, it's copied to the program named with the substring of "dcsasmex" that matches the namelength of the original program.


Yes, so how would you have a recursive call to an archived program? Too bad there's no prgmTHIS in TI-BASIC 0x5
Oh, now I see your point. Yeah, recursive programs wouldn't work so well. But then again, most recursive programs have a wrapper that sets up the recursion variables and then a subprogram that's the actual recursive loop.
Just to refresh my memory, what happens to the programs between the :A and : ? Do they get unarchived or copied to ram, or what?
Unarchived, then rearchived.
How about, instead, doing this to save flash usage?
calc84maniac wrote:
1- Create new program with same name and size
2- Copy data from archive into program
3- Insert VAT entry at the beginning of the program/list VAT. Then when it calls itself, it will work.
4- Delete duplicate program
That's a good logical way of looking at it, except for a flaw in step 1. The TI-OS goes absolutely ballistic if you have two files with the same name: incorrect pointers and such thrown everywhere. It's even worse if one's in RAM and one in ROM. Bad, bad idea.
I think it can only 'see' the first one, since when you chkfindsym, it stops searching at the first one. I have had more than one of the same program before, when I run it, it runs the first one in the VAT. I think it would work...
  
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
Page 1 of 2
» All times are UTC - 5 Hours
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

 

Advertisement