Omnimaga

Calculator Community => TI Calculators => Axe => Topic started by: aeTIos on March 04, 2011, 01:09:34 pm

Title: Basic or Assembly?
Post by: aeTIos on March 04, 2011, 01:09:34 pm
I have a question:
How can you find out if a program is Basic or (nostub) ASM? I dont know it, but it'll very useful to me, because i want to create a shell <<<Yea, a SHELL, and not for fuel ;D
Title: Re: Basic or Assembly?
Post by: Munchor on March 04, 2011, 01:22:57 pm
You mean on-calc? I think that for that you'd need to analyse the hex code (headers).
Title: Re: Basic or Assembly?
Post by: Runer112 on March 04, 2011, 02:43:26 pm
The first two bytes of an assembly program (not counting the size bytes) are required to be $BB, $6D. That is how the OS determines whether or not a program is an assembly program.
Title: Re: Basic or Assembly?
Post by: Munchor on March 04, 2011, 02:44:49 pm
The first two bytes of an assembly program (not counting the size bytes) are required to be $BB, $6D. That is how the OS determines whether or not a program is an assembly program.

That is super easy then :) Thanks too.
Title: Re: Basic or Assembly?
Post by: Xeda112358 on March 04, 2011, 03:27:49 pm
If it is BB6C, then it is an uncompressed assembly program.
Title: Re: Basic or Assembly?
Post by: Broseph Radson on March 04, 2011, 04:56:06 pm
I was wondering this too, for the same purpose in fact. How would one go about testing this? I can use memkit to get the pointer to a program so what do i do to after that? EDIT: I guess i cant get the pointer with memkit. dim()r gives a bad symbol error x.x
Title: Re: Basic or Assembly?
Post by: Deep Toaster on March 04, 2011, 06:16:54 pm
I was wondering this too, for the same purpose in fact. How would one go about testing this? I can use memkit to get the pointer to a program so what do i do to after that? EDIT: I guess i cant get the pointer with memkit. dim()r gives a bad symbol error x.x

You don't need Memkit for that. Axe already has commands built-in to find and manipulate variables. GetCalc( is already a very easy-to-use command to find programs.

Quote from: Axe

:GetCalc("prgmNAME")→P
:If {P}r=E6DBB
:. ASM program
:ElseIf {P}r=E6CBB
:. Unsquished ASM program
:Else
:. BASIC program/Axe source


Notice that the BB6D and BB6C are reversed (as 6DBB and 6CBB respectively). This is because two-byte numbers are stored backwards.
Title: Re: Basic or Assembly?
Post by: Broseph Radson on March 04, 2011, 06:55:34 pm
Ah i c that was easy thanks ;D. I can use GetCalc with memkit (to list only basic or asm programs) but its a bit more code than dim()r would be.
Title: Re: Basic or Assembly?
Post by: Deep Toaster on March 04, 2011, 06:56:40 pm
Ah i c that was easy thanks ;D. I can use GetCalc with memkit (to list only basic or asm programs) but its a bit more code than dim()r would be.

GetCalc( doesn't list programs. It just looks for a program (or creates one, if you add a second argument).
Title: Re: Basic or Assembly?
Post by: Broseph Radson on March 04, 2011, 07:00:03 pm
Code: [Select]
#Axiom(MEMKIT)
Load()
While Next()
Print(L1)
"prgm"L1->A ;or something to that effect
GetCalc(A)->P
If {P}r=E6DBB or {P}r=E6CBB
Disp L1
Disp i
End
End

Is what i meant sorry lol

EDIT: It worked ;D
Title: Re: Basic or Assembly?
Post by: aeTIos on March 05, 2011, 08:24:06 am
If it is BB6C, then it is an uncompressed assembly program.
Yes, I found this out too. (thanks to XXEdit)
I am now getting the headers for Ion, MOS and DCS with XXEdit.
Title: Re: Basic or Assembly?
Post by: Deep Toaster on March 05, 2011, 09:34:26 am
If it is BB6C, then it is an uncompressed assembly program.
Yes, I found this out too. (thanks to XXEdit)
I am now getting the headers for Ion, MOS and DCS with XXEdit.

Remember that shell headers can contain a description or icon. To make things easier for ya:

Ion headers

There are two types of Ion programs: those that can be run from the homescreen and those that can't. The difference is that if a program uses Ion-specific routines, it'd be pointless (and dangerous) to allow it to run from the homescreen, hence the two header formats:

Code: (Homescreen-runnable) [Select]
BB
6D
AF
30
XX
DESCRIPTION
00
Code: (Shell only) [Select]
BB
6D
C9
30
XX
DESCRIPTION
00

The only difference between the two versions is that one has an AF as the third byte, while the other has a C9.

DESCRIPTION is the description of the program in ASCII. It can be anywhere from 0 to 127 bytes long.

XX is the length of the DESCRIPTION plus one.

If you want to simply determine if a program is an Ion program, just know that it either starts with BB6DAF30 or BB6DC930.

MirageOS headers

There is only one version of the MirageOS header, one that is not compatible from the homescreen (hence why MOS prgms quit immediately when you try running them with Asm().

Code: (MirageOS) [Select]
BB
6D
C9
01
HHHH
HHHH
HHHH
HHHH
HHHH
HHHH
HHHH
HHHH
HHHH
HHHH
HHHH
HHHH
HHHH
HHHH
HHHH
DESCRIPTION
00

DESCRIPTION is the same as Ion's DESCRIPTION. The mass of Hs is the icon; it's 15x15 (with an extra zero padded to each row), so it's 30 bytes total.

All you need to know to determine if it's a MirageOS program is that a MirageOS program starts with BB6DC901.

DoorsCS headers

These get a bit complicated. It involves a lot of pointers, referencing, and calculating, so I won't post the full header here (it's at http://dcs.cemetech.net/index.php?title=ASM_Header if you're interested). But here's what you want to know:

To determine if a program is a DoorsCS program, check if it starts with BB6DAAC9.
Title: Re: Basic or Assembly?
Post by: aeTIos on March 05, 2011, 01:56:51 pm
Thanks, although I figured it out myself this afternoon :) but it might be useful to other members
Title: Re: Basic or Assembly?
Post by: ztrumpet on March 06, 2011, 11:23:46 am
That was really interesting for me, Deep.  Thank you! ;D
Title: Re: Basic or Assembly?
Post by: calc84maniac on March 06, 2011, 01:12:24 pm
The mass of Hs is the icon; it's 15x15 (with an extra zero padded to each row), so it's 32 bytes total.
Actually, that would be 30 bytes because there isn't an extra row, just an extra column.
Title: Re: Basic or Assembly?
Post by: Deep Toaster on March 06, 2011, 03:58:34 pm
The mass of Hs is the icon; it's 15x15 (with an extra zero padded to each row), so it's 32 bytes total.
Actually, that would be 30 bytes because there isn't an extra row, just an extra column.

Thanks for the catch. Dunno what I was thinking there.