Omnimaga

Calculator Community => TI Calculators => General Calculator Help => Topic started by: Happybobjr on November 20, 2010, 11:28:31 am

Title: [question] Mirage 16x16 pic
Post by: Happybobjr on November 20, 2010, 11:28:31 am
how/where is the 16x16 icon added in mirrage programs?
I mean like the memory location.   Would i be able to make an icon editor in axe?
Title: Re: [question] Mirage 16x16 pic
Post by: Deep Toaster on November 20, 2010, 11:35:36 am
Yeah, you could. It's actually 15x15, like

Code: [Select]
11111111 11111110
10000000 00000010
10000000 00000010
10000000 00000010
10000000 00000010
10000000 00000010
10000000 00000010
10000000 00000010
10000000 00000010
10000000 00000010
10000000 00000010
10000000 00000010
10000000 00000010
10000000 00000010
11111111 11111110

The zeroes on the rightmost column are for padding.

To make a program show a custom icon, set Axe to compile for no shell, then in the program, use this heading:

Code: (Axe) [Select]
:.NAME
:Asm(C901)
:Asm(30-BYTE (64-CHAR) HEX ICON)
:Asm(DESCRIPTION IN HEX)
:Asm(00)

EDIT: Here's SirCmpwn's post (with routine): http://ourl.ca/4129/80700
Title: Re: [question] Mirage 16x16 pic
Post by: Happybobjr on November 20, 2010, 11:39:09 am
where is it. byte wise.

I was thinking of a program to change any mos's prgm's icons
Title: Re: [question] Mirage 16x16 pic
Post by: Deep Toaster on November 20, 2010, 11:40:16 am
Oh, the icon is the 30 bytes starting with the 5th byte of the program.
Title: Re: [question] Mirage 16x16 pic
Post by: squidgetx on November 20, 2010, 11:40:34 am
Apparently starting with the 2nd byte of the program :P

...edit: fail
Title: Re: [question] Mirage 16x16 pic
Post by: Deep Toaster on November 20, 2010, 11:43:05 am
Nope, it's the 5th (after $BB,$6D for the ASM header and $C9,$01 for the MirageOS header).

To access it, use something like GetCalc("prgmNAME")+4 (since it starts after the 4th byte).
Title: Re: [question] Mirage 16x16 pic
Post by: Happybobjr on November 20, 2010, 11:53:59 am
would i be able to make an icon editor in axe?

Would i just
psudocode

getcalc("prgmPROGRAM")->A
{A-2}r + 30 -> {A-2}r   (note: i have tested successfully that increasing prgm size works  (although I have only tried once))
the shift all but the first 5 (?) bytes down 30.
add the picture to those 30 bytes.

would that work?
Title: Re: [question] Mirage 16x16 pic
Post by: Deep Toaster on November 20, 2010, 11:56:06 am
Well, that would work, but remember you're still overwriting the 30 bytes that come after the program data.

An easier way is to get the user to compile the program as MirageOS, and since it already comes with 30 bytes of the default Axe icon, you can just change that directly without having to worry about size changing or moving stuff around.
Title: Re: [question] Mirage 16x16 pic
Post by: Happybobjr on November 20, 2010, 12:04:22 pm
ok,  Well come to think of it, i could just have the code look for if it is or is not a mos prgm.
if not, nothing will happen.

How do i see if the first byte is rt.  (in axe)

also, would i just add the hex of the picture in the 30 bytes?
Title: Re: [question] Mirage 16x16 pic
Post by: Deep Toaster on November 21, 2010, 11:46:12 am
ok,  Well come to think of it, i could just have the code look for if it is or is not a mos prgm.
if not, nothing will happen.

How do i see if the first byte is rt.  (in axe)

also, would i just add the hex of the picture in the 30 bytes?

Yeah, basically it's 2 bytes per row but not using the last row. Not sure what you mean by seeing if the first byte is rt... If you mean checking if the program starts with [BB6DC901] (the entire MOS header), the most efficient way is something like this:

Code: (Axe) [Select]
:GetCalc("prgmNAME")→P    .Find the program
:!If {P}r-28091    .Check if it starts with $BB,$6D
:!If {P+2}r-457    .Check if the next two bytes are $C9,$01
:...
:.It's a MOS program, so do whatever you want with it.
:...
:End
:End


I'd check for two bytes at once (with the r) because it's faster and smaller. 28091 and 457 are used here because 28091 is the combined two bytes of $BB,$6D and 457 is the combined two bytes of $C9,$01.
Title: Re: [question] Mirage 16x16 pic
Post by: Happybobjr on November 21, 2010, 07:13:01 pm
oh ok,  I thought mirage os programs started with return. Isn't rt  return (i assumed as i have no experiance with asm)
Title: Re: [question] Mirage 16x16 pic
Post by: Deep Toaster on November 21, 2010, 07:25:02 pm
Yeah, return is C9. MirageOS programs have a header of a return (RET) followed by the number 1 (don't ask why, it's just there). But all ASM programs start with the two bytes $BB,$6D, which come before the RET, so you'd have to check for that as well.