Omnimaga

Calculator Community => TI Calculators => ASM => Topic started by: Hot_Dog on January 01, 2011, 08:41:44 pm

Title: Running ASM programs larger than 8 KB
Post by: Hot_Dog on January 01, 2011, 08:41:44 pm
I'm wondering: If an asm program is archived, does the calculator make sure that it doesn't go across two pages unless absolutely necessary?  If that's the case, running larger ASM programs without SMC is theortically possible, as long as they are archived
Title: Re: Running ASM programs larger than 8 KB
Post by: calcdude84se on January 01, 2011, 09:11:48 pm
No guarantee of that at all AFAIK. It can't cross sector boundaries, but there is no guarantee it won't cross page boundaries.
Even for programs that don't, you have to deal with the fact that they could be at any address, and you need to write localized code. (which, on the z80, is somewhat inconvenient. No direct calls or jumps, for instance. It's not impossible, though)
Title: Re: Running ASM programs larger than 8 KB
Post by: FloppusMaximus on January 01, 2011, 09:20:39 pm
No.  Each archive sector is a separate "box" that can hold up to 64k of variables.  So a single variable can't cross a sector boundary.  But the OS will pack variables as tightly as it can into each box, not worrying about the internal page boundaries.

Also, the archive area is restricted; if you try to execute code there, the calculator will reset, just as if you try to execute code on RAM page zero.
Title: Re: Running ASM programs larger than 8 KB
Post by: Hot_Dog on January 01, 2011, 09:22:34 pm
No.  Each archive sector is a separate "box" that can hold up to 64k of variables.  So a single variable can't cross a sector boundary.  But the OS will pack variables as tightly as it can into each box, not worrying about the internal page boundaries.

Also, the archive area is restricted; if you try to execute code there, the calculator will reset, just as if you try to execute code on RAM page zero.

Then why are applications able to run?  Do they fall under "not archive?"
Title: Re: Running ASM programs larger than 8 KB
Post by: FloppusMaximus on January 01, 2011, 09:29:06 pm
Right.  The OS adjusts the limits whenever you install or delete an application.  On the SE/84+, the "archive area" is defined by ports 22 and 23; on the 83+ BE, pages can be individually enabled or disabled using port 16.  All these ports are protected so that user programs can't (normally) modify them.
Title: Re: Running ASM programs larger than 8 KB
Post by: calcdude84se on January 01, 2011, 10:09:14 pm
Could one theoretically unlock flash, write a routine to output to protected ports to a privileged page, and adjust those ports? Will the OS change them outside of receiving/deleting apps?
On a related note, WikiTI's Port $05 page (http://wikiti.brandonw.net/index.php?title=83Plus:Ports:05) makes it seem like, on a regular TI-83+, the execution protection could be removed. Do you know if this is possible?
Title: Re: Running ASM programs larger than 8 KB
Post by: FloppusMaximus on January 01, 2011, 10:17:13 pm
Could one theoretically unlock flash, write a routine to output to protected ports to a privileged page, and adjust those ports?
Yes, theoretically, that should be possible.  The simplest way to adjust the Flash execution limits, though, is to use the BCALL 80CF.
Quote
Will the OS change them outside of receiving/deleting apps?
I don't think so, but I'm not sure.
Quote
On a related note, WikiTI's Port $05 page (http://wikiti.brandonw.net/index.php?title=83Plus:Ports:05) makes it seem like, on a regular TI-83+, the execution protection could be removed. Do you know if this is possible?
I believe so.
Title: Re: Running ASM programs larger than 8 KB
Post by: calcdude84se on January 01, 2011, 10:22:35 pm
That's rather simple :)
What of executing on RAM page 0 on an 83+? Or was that what you answered yes to?
Title: Re: Running ASM programs larger than 8 KB
Post by: Hot_Dog on January 01, 2011, 11:27:05 pm
So theoretically, one could pirate applications as ASM programs :angel:

By the way, couldn't one simply change the application header to make an application valid without needing a certificate (therefore making it free)?
Title: Re: Running ASM programs larger than 8 KB
Post by: jnesselr on January 02, 2011, 05:54:10 pm
So theoretically, one could pirate applications as ASM programs :angel:

By the way, couldn't one simply change the application header to make an application valid without needing a certificate (therefore making it free)?
I don't think so. I know that there is a patch that makes all apps seem valid when receiving, though.
Title: Re: Running ASM programs larger than 8 KB
Post by: DJ Omnimaga on January 04, 2011, 01:29:55 am
The 8 KB limit was added to prevent the conversion of paid APPs to 8xp files, right?
Title: Re: Running ASM programs larger than 8 KB
Post by: Builderboy on January 04, 2011, 01:33:20 am
Supposedly, although who knows with TI :/ Maybe it was an accident, and they don't know how to fix it :P
Title: Re: Running ASM programs larger than 8 KB
Post by: Hot_Dog on January 04, 2011, 02:02:33 am
Supposedly, although who knows with TI :/ Maybe it was an accident, and they don't know how to fix it :P

I'm pretty sure it was done intentionally.  A processor that "locks up" to prevent larger sizes is no coincidence from TI, because Zilog would have been sued for something like that.
Title: Re: Running ASM programs larger than 8 KB
Post by: Builderboy on January 04, 2011, 02:14:48 am
Lol i was half joking, but yeah i know what you mean
Title: Re: Running ASM programs larger than 8 KB
Post by: Hot_Dog on January 04, 2011, 02:19:35 am
Oops, of course  :-[
Title: Re: Running ASM programs larger than 8 KB
Post by: Builderboy on January 04, 2011, 02:20:19 am
Haha its fine, it happens round the nets :)
Title: Re: Running ASM programs larger than 8 KB
Post by: DJ Omnimaga on January 04, 2011, 02:22:58 am
Supposedly, although who knows with TI :/ Maybe it was an accident, and they don't know how to fix it :P

I'm pretty sure it was done intentionally.  A processor that "locks up" to prevent larger sizes is no coincidence from TI, because Zilog would have been sued for something like that.
Also, on the TI-73, there's no such limit. This calc also cannot natively run ASM programs (no Asm() command). You have to hack it the same way we did back in the '90s with the TI-82, 85 and 92 series. Coincidence? I don't think so. Due to lack of an Asm() command, no need to add a limit. As a result, if you use Chameleon on a 73 (by BrandonW) to convert it into a TI-83+, you get a TI-83+ that lacks the 8 KB limit.
Title: Re: Running ASM programs larger than 8 KB
Post by: Quigibo on January 04, 2011, 02:49:11 am
By the way, I just though about this... you *could* run a contiguous program of 32kb on the calculator.  Its easy too.  In a 2 page app, just swap the 2nd page of the app into the $8000-$BFFF region and that's it!  Unfortunately though, you wouldn't be able to call any OS bcalls or use self modifying code, but other than that, it would work.
Title: Re: Running ASM programs larger than 8 KB
Post by: Hot_Dog on January 04, 2011, 02:51:25 am
By the way, I just though about this... you *could* run a contiguous program of 32kb on the calculator.  Its easy too.  In a 2 page app, just swap the 2nd page of the app into the $8000-$BFFF region and that's it!  Unfortunately though, you wouldn't be able to call any OS bcalls or use self modifying code, but other than that, it would work.

Wouldn't jumps have an issue if you had to jump to a different page?  It would mean a lot of ram page swapping, wouldn't it?
Title: Re: Running ASM programs larger than 8 KB
Post by: DJ Omnimaga on January 04, 2011, 02:52:29 am
Do you mean we would need to carry an additional 32 KB APP that contains the code to be copied in the 8xp program?
Title: Re: Running ASM programs larger than 8 KB
Post by: Quigibo on January 04, 2011, 02:56:25 am
Wouldn't jumps have an issue if you had to jump to a different page?  It would mean a lot of ram page swapping, wouldn't it?

Nope, if its only 2 pages, there are no other pages.  Page 1 is $4000-$7FFF and page 2 is $8000-$BFFF.  A jump to say... $9001 would simply be jp $9001.  You just have to have your orgin on page 2 to .org $8000 and .org $4000 on page 1.
Title: Re: Running ASM programs larger than 8 KB
Post by: jnesselr on January 04, 2011, 06:15:40 pm
Wouldn't jumps have an issue if you had to jump to a different page?  It would mean a lot of ram page swapping, wouldn't it?

Nope, if its only 2 pages, there are no other pages.  Page 1 is $4000-$7FFF and page 2 is $8000-$BFFF.  A jump to say... $9001 would simply be jp $9001.  You just have to have your orgin on page 2 to .org $8000 and .org $4000 on page 1.
Note that a bunch of routines wouldn't be available in this mode.  Interrupts as well.