Omnimaga

Calculator Community => TI Calculators => ASM => Topic started by: ACagliano on July 02, 2011, 07:58:21 pm

Title: App Programming
Post by: ACagliano on July 02, 2011, 07:58:21 pm
Can someone help me with this concept? I'm reopening the Zelda project, in z80. I want to make it an app, as its data alone will take up at least one page. The code itself will be probably less than one page. How do I go about this? How does the header differ and what must be coded differently? I heard there are caveats to using the b_calls in an app? How do you work around this? If I wrote it as a program, entirely, would it be easy for someone to just app-ify it? 
Title: Re: App Programming
Post by: thepenguin77 on July 02, 2011, 08:02:15 pm
Writing the app is pretty simple if you use spasm. You don't really have to change much, aside from changing the output file name to .8xk.

Here is what I wrote in a topic a while back:
1. Your code will be running from the $4000-$7FFF page, which means you need to do .org $4000 instead of .org $9D95
2. You need a header, (which you can get from here (http://education.ti.com/calculators/downloads/US/Software/Download/en/177/6653/appheader.zip))
3. You will have to use bcall(_jForceCMDNoChar) or similar to return as the OS jp's to the app, it doesn't call it
4. Most bcall's that take ptr's for inputs won't work if you give them an address in the $4000-$7FFF area. What this means is that you either need to reimplement bcall(_putS) with bcall(_putC), or copy all your strings to ram before displaying them
5. Obviously, don't change port 06 unless you have copied your routine to ram


6. And most importantly, you must compile your program for hex and then sign it, I would highly suggest that you just use spasm and make the output .8xk rather than .8xp. This will save you a lot of trouble.

Edit:
    And if your program size is going to be <20KB, you might want to consider making it a program since now we can run code at >C000.
Title: Re: App Programming
Post by: ACagliano on July 02, 2011, 08:13:33 pm
By your edit, you are referring to zStart, correct? But, no it will likely be between 20 and 30k.

Use jForceCMDNoChar at the end?

And, is there a mac version of spasm that I can use?
Title: Re: App Programming
Post by: shmibs on July 02, 2011, 08:51:02 pm
i don't think that there is an osx version of spasm, but you can always run it under wine.
Title: Re: App Programming
Post by: ZippyDee on July 03, 2011, 02:11:38 am
WabbitCode makes .8xk files for apps. I'm using it on my OSX for my IDE I'm developing.
Title: Re: App Programming
Post by: BuckeyeDude on July 03, 2011, 02:18:17 am
Yes there is a mac version of spasm. I've uploaded it to codeplex to make it easier to find. http://wabbit.codeplex.com/releases/view/45088 (http://wabbit.codeplex.com/releases/view/45088). You might also want to check out Wabbitcode for the Mac.
Title: Re: App Programming
Post by: thepenguin77 on July 04, 2011, 03:14:16 pm
By your edit, you are referring to zStart, correct? But, no it will likely be between 20 and 30k.

You can do it without zStart. In fact, you really shouldn't rely on zStart. The code to do it is only about 30 bytes. But if it's going to end up around 30k, then it should go in an app.
Title: Re: App Programming
Post by: ACagliano on July 04, 2011, 06:47:04 pm
I have the mac version of wabbitcode. Do I need this stuff? It's saying error on the first two includes.:

.nolist
include   "ti83plus.inc"
include   "dcs7.inc"
include   "app.inc"
.list
Title: Re: App Programming
Post by: DrDnar on July 04, 2011, 10:55:58 pm
You can run your program from RAM and stream data from the archive, although the variable-location nature of the archive can be a hassle. If your code totals less than about 20 K, as thepenguin77 noted above, you can run entirely from RAM, and the code for unlocking all of RAM for execution isn't very big. (Don't go too close to the 24 K limit or people with huge VATs will have trouble.) Running from RAM makes accessing a lot of data easier, as you can page 4000h around without incurring the cost of off-page b_calls. (The official method of accessing code/data outside of the current page involves using an extension of b_calls.)

Make sure all of your includes are in a place where Spasm can find them, which typically means the same directory as everything else. Also, Spasm may require that the include directive be prefixed with a pound (#).