Author Topic: Program Icons  (Read 4726 times)

0 Members and 1 Guest are viewing this topic.

Offline ClrDraw

  • LV7 Elite (Next: 700)
  • *******
  • Posts: 627
  • Rating: +61/-2
    • View Profile
    • GitHub
Program Icons
« 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?
Visit my GitHub for all my TI programs as well as other projects.
Also check out my website.

Offline Runer112

  • Project Author
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2289
  • Rating: +639/-31
    • View Profile
Re: Program Icons
« Reply #1 on: October 27, 2013, 10:51:52 pm »
The Doors CS and MirageOS BASIC header formats can be found here, the Doors CS assembly header format can be found here, and the MirageOS assembly header format can be found here. 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() 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{} to store each nibble or combining two nibbles manually to store each byte.
« Last Edit: October 27, 2013, 10:58:53 pm by Runer112 »

Offline ClrDraw

  • LV7 Elite (Next: 700)
  • *******
  • Posts: 627
  • Rating: +61/-2
    • View Profile
    • GitHub
Re: Program Icons
« Reply #2 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.
Visit my GitHub for all my TI programs as well as other projects.
Also check out my website.

Offline Runer112

  • Project Author
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2289
  • Rating: +639/-31
    • View Profile
Re: Program Icons
« Reply #3 on: October 27, 2013, 11:38:17 pm »
As far as I know, there's no reason why Bitmap() wouldn't work in applications.

Offline ClrDraw

  • LV7 Elite (Next: 700)
  • *******
  • Posts: 627
  • Rating: +61/-2
    • View Profile
    • GitHub
Re: Program Icons
« Reply #4 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
Visit my GitHub for all my TI programs as well as other projects.
Also check out my website.

Offline ClrDraw

  • LV7 Elite (Next: 700)
  • *******
  • Posts: 627
  • Rating: +61/-2
    • View Profile
    • GitHub
Re: Program Icons
« Reply #5 on: November 01, 2013, 05:48:55 pm »
Are Mirage OS programs just like regular ASM programs except with the header?
Visit my GitHub for all my TI programs as well as other projects.
Also check out my website.

Offline tpt1234567890

  • LV3 Member (Next: 100)
  • ***
  • Posts: 45
  • Rating: +0/-0
    • View Profile
Re: Program Icons
« Reply #6 on: November 01, 2013, 05:49:39 pm »
Thanks for giving the link to the headers! I was wondering this as well...

Offline Runer112

  • Project Author
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2289
  • Rating: +639/-31
    • View Profile
Re: Program Icons
« Reply #7 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.
« Last Edit: November 01, 2013, 06:01:01 pm by Runer112 »

Offline ClrDraw

  • LV7 Elite (Next: 700)
  • *******
  • Posts: 627
  • Rating: +61/-2
    • View Profile
    • GitHub
Re: Program Icons
« Reply #8 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  :-\
Visit my GitHub for all my TI programs as well as other projects.
Also check out my website.

Offline ClrDraw

  • LV7 Elite (Next: 700)
  • *******
  • Posts: 627
  • Rating: +61/-2
    • View Profile
    • GitHub
Re: Program Icons
« Reply #9 on: November 07, 2013, 08:09:44 pm »
Is there a way to tell if the program uses libraries?
Visit my GitHub for all my TI programs as well as other projects.
Also check out my website.

Offline Runer112

  • Project Author
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2289
  • Rating: +639/-31
    • View Profile
Re: Program Icons
« Reply #10 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.
« Last Edit: November 08, 2013, 03:09:01 am by Runer112 »