Author Topic: Running a No-Stub from an App  (Read 2802 times)

0 Members and 1 Guest are viewing this topic.

Offline ralphdspam

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 841
  • Rating: +38/-1
  • My name is actually Matt.
    • View Profile
Running a No-Stub from an App
« 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. :)
ld a, 0
ld a, a

Offline thepenguin77

  • z80 Assembly Master
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1594
  • Rating: +823/-5
  • The game in my avatar is bit.ly/p0zPWu
    • View Profile
Re: Running a No-Stub from an App
« Reply #1 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). 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.
zStart v1.3.013 9-20-2013 
All of my utilities
TI-Connect Help
You can build a statue out of either 1'x1' blocks or 12'x12' blocks. The 1'x1' blocks will take a lot longer, but the final product is worth it.
       -Runer112

Offline ralphdspam

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 841
  • Rating: +38/-1
  • My name is actually Matt.
    • View Profile
Re: Running a No-Stub from an App
« Reply #2 on: May 14, 2011, 05:01:52 pm »
Thanks. :) How would I find the address for the program in flash?
« Last Edit: May 14, 2011, 05:02:42 pm by ralphdspam »
ld a, 0
ld a, a

Offline Deep Toaster

  • So much to do, so much time, so little motivation
  • Administrator
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 8217
  • Rating: +758/-15
    • View Profile
    • ClrHome
Re: Running a No-Stub from an App
« Reply #3 on: May 14, 2011, 05:04:25 pm »
_ChkFindSym is what you want. See 28D's page on user variables.




Offline thepenguin77

  • z80 Assembly Master
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1594
  • Rating: +823/-5
  • The game in my avatar is bit.ly/p0zPWu
    • View Profile
Re: Running a No-Stub from an App
« Reply #4 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.
zStart v1.3.013 9-20-2013 
All of my utilities
TI-Connect Help
You can build a statue out of either 1'x1' blocks or 12'x12' blocks. The 1'x1' blocks will take a lot longer, but the final product is worth it.
       -Runer112