Omnimaga

Calculator Community => TI Calculators => Axe => Topic started by: ClrDraw on October 27, 2013, 10:26:26 pm

Title: Program Icons
Post by: ClrDraw on October 27, 2013, 10:26:26 pm
DoorsCS and MirageOS both show program icons. How do I get a programs icon and display it?
Title: Re: Program Icons
Post by: Runer112 on October 27, 2013, 10:51:52 pm
The Doors CS and MirageOS BASIC header formats can be found here (http://dcs.cemetech.net/index.php/BASIC_Header), the Doors CS assembly header format can be found here (http://dcs.cemetech.net/index.php/ASM_Header), and the MirageOS assembly header format can be found here (http://z80-heaven.wikidot.com/shells#toc1). These formats should dictate both how to determine which header a program is using and, once identified, where in the header the icon data can be found.

The assembly header icons are stored as raw binary data and could be displayed easily enough using the Bitmap() (http://axe.eeems.ca/Commands.html#spritesCommands) command. You would have to copy the icons to free RAM somewhere to allow you put the width and height bytes before the icon data, though. Keep in mind that while the Doors CS icons are 16x16, the MirageOS icons are actually only 15x15.

The BASIC header icons are a bit trickier, because they're stored as hexadecimal strings rather than raw data. You would probably want to convert the hexadecimal representation into a raw bitmap representation (like for assembly icons) in free RAM somewhere, supplying the width and height bytes and then converting each hexadecimal character into a nibble of raw data (perhaps with code like (CHAR≤'9'?CHAR-'0',CHAR-'A'+10)) and using →nib{} (http://axe.eeems.ca/Commands.html#dataAndStorageCommands) to store each nibble or combining two nibbles manually to store each byte.
Title: Re: Program Icons
Post by: ClrDraw on October 27, 2013, 11:27:15 pm
Thank you so much. Will Bitmap() still work if I compile into an app? It didn't work with a different program.
Title: Re: Program Icons
Post by: Runer112 on October 27, 2013, 11:38:17 pm
As far as I know, there's no reason why Bitmap() wouldn't work in applications.
Title: Re: Program Icons
Post by: ClrDraw on October 27, 2013, 11:52:42 pm
That's so weird, nevermind... I just tried it again and it works just fine. I bet I made a stupid mistake last time  XD
Title: Re: Program Icons
Post by: ClrDraw on November 01, 2013, 05:48:55 pm
Are Mirage OS programs just like regular ASM programs except with the header?
Title: Re: Program Icons
Post by: tpt1234567890 on November 01, 2013, 05:49:39 pm
Thanks for giving the link to the headers! I was wondering this as well...
Title: Re: Program Icons
Post by: Runer112 on November 01, 2013, 05:58:47 pm
Are Mirage OS programs just like regular ASM programs except with the header?

I'm assuming you're talking about MirageOS assembly programs, in which case the answer is both yes and no. But primarily no. Yes because both are assembly programs that run natively on the calculator's z80 processor. No because, as you can see if you look at the MirageOS (or Doors CS) assembly header, they have a ret instruction right at the beginning so if they are run through the normal OS manner, they will return instantly. This is partly due to the other, more important "no" reason, which is that MirageOS and Doors CS provide libraries of useful routines which assembly programs with the shell header may rely on being present to use. For instance, it's quite common for assembly programs targeted at these shells to use the built-in screen update, sprite, and random number routines, among others. BASIC programs with a MirageOS header will not have this problem, as MirageOS provides no BASIC libraries. But Doors CS does, so BASIC programs with a Doors CS header also may rely on Doors CS being present.
Title: Re: Program Icons
Post by: ClrDraw on November 01, 2013, 06:16:11 pm
Darn... I was hoping I could just copy the program without the header to a new program and run that  :-\
Title: Re: Program Icons
Post by: ClrDraw on November 07, 2013, 08:09:44 pm
Is there a way to tell if the program uses libraries?
Title: Re: Program Icons
Post by: Runer112 on November 08, 2013, 03:08:33 am
You could try to scan the executable for any assembly instructions in the program that call or jump to a shell routine vector. It's not foolproof, but it should ideally only rarely incorrectly determine if the program has a shell dependency, and when it does do it incorrectly, it hopefully would be a false positive more often than a false negative.