Omnimaga

Calculator Community => TI Calculators => ASM => Topic started by: ralphdspam on May 14, 2011, 12:22:31 am

Title: Running a No-Stub from an App
Post by: ralphdspam on May 14, 2011, 12:22:31 am
Hello,

How exactly do I run an archived No-Stub program from an App.  I know that it involves reading from the VAT, switching one of the flash pages, and copying the contents to $9D95.  How exactly do I go about doing this?

Thanks in advanced. :)
Title: Re: Running a No-Stub from an App
Post by: thepenguin77 on May 14, 2011, 08:57:41 am
Well, actually there are two ways.

1. You can do it the TI way. Find the program, make sure it is in ram, load it's name into op1, then bcall(_executePrgm) (http://wikiti.brandonw.net/index.php?title=83Plus:BCALLs:4E7C). This is the easy way, but it's limited by what TI can do.

2. Find the program, and you'll have to do different things based on whether it's in flash or ram.
    Flash: find the start of the program in flash, bcall(_insertMem) size - 2 at $9D95, ldir the program without the $BB, $6D to $9D95. When you are done, just bcall(_delMem) the $9D95 for the size you inserted.
    Ram: find the start of the program in ram, copy the program 768 bytes at a time by 1) ldir 768 bytes to saveSScreen, 2) bcall(_delMem) the bytes you just copied, 3) bcall(_insertMem) 768 bytes at $9D95, 4) ldir the bytes there, 5) repeat. When you are done, just do this but instead copy from $9D95 to the little stub of a program you left earlier. And don't forget, _insertMem and _delMem shift all memory, so you'll have to adjust your pointers while copying.
Title: Re: Running a No-Stub from an App
Post by: ralphdspam on May 14, 2011, 05:01:52 pm
Thanks. :) How would I find the address for the program in flash?
Title: Re: Running a No-Stub from an App
Post by: Deep Toaster on May 14, 2011, 05:04:25 pm
_ChkFindSym (http://wikiti.brandonw.net/index.php?title=83Plus:BCALLs:42F1) is what you want. See 28D's page on user variables (http://eeezor.ec3club.tk/Files/Resources/Tutorials/ASMin28Days/lesson/day19.html).
Title: Re: Running a No-Stub from an App
Post by: thepenguin77 on May 14, 2011, 05:47:39 pm
It starts with _chkFindSym, but that only gives you the start of the flash header in flash. You then need to forward your way to the actual program data. Here's what you'll be looking at:
Code: [Select]
flash flag | flash size L | flash size H | variable type | T2 | Version | address L | address H | page | name length | - Name 1-8 bytes -

So, you need to add 9. Check to make sure it didn't cross $8000, get the name length, then add the name length and check again that it didn't cross $8000. Then you can just read the size bytes and do a _flashToRam.