Author Topic: Basic or Assembly?  (Read 5729 times)

0 Members and 1 Guest are viewing this topic.

Offline aeTIos

  • Nonbinary computing specialist
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3913
  • Rating: +184/-32
    • View Profile
    • wank.party
Basic or Assembly?
« 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
I'm not a nerd but I pretend:

Offline Munchor

  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 6199
  • Rating: +295/-121
  • Code Recycler
    • View Profile
Re: Basic or Assembly?
« Reply #1 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).

Offline Runer112

  • Project Author
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2289
  • Rating: +639/-31
    • View Profile
Re: Basic or Assembly?
« Reply #2 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.

Offline Munchor

  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 6199
  • Rating: +295/-121
  • Code Recycler
    • View Profile
Re: Basic or Assembly?
« Reply #3 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.

Offline Xeda112358

  • they/them
  • Moderator
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 4699
  • Rating: +718/-6
  • Calc-u-lator, do doo doo do do do.
    • View Profile
Re: Basic or Assembly?
« Reply #4 on: March 04, 2011, 03:27:49 pm »
If it is BB6C, then it is an uncompressed assembly program.

Offline Broseph Radson

  • LV5 Advanced (Next: 300)
  • *****
  • Posts: 295
  • Rating: +20/-1
  • Its 0x1A4 somewhere
    • View Profile
Re: Basic or Assembly?
« Reply #5 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
« Last Edit: March 04, 2011, 05:13:04 pm by Broseph Radson »

Offline Deep Toaster

  • So much to do, so much time, so little motivation
  • Administrator
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 8217
  • Rating: +758/-15
    • View Profile
    • ClrHome
Re: Basic or Assembly?
« Reply #6 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.
« Last Edit: March 04, 2011, 06:17:39 pm by Deep Thought »




Offline Broseph Radson

  • LV5 Advanced (Next: 300)
  • *****
  • Posts: 295
  • Rating: +20/-1
  • Its 0x1A4 somewhere
    • View Profile
Re: Basic or Assembly?
« Reply #7 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.

Offline Deep Toaster

  • So much to do, so much time, so little motivation
  • Administrator
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 8217
  • Rating: +758/-15
    • View Profile
    • ClrHome
Re: Basic or Assembly?
« Reply #8 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).




Offline Broseph Radson

  • LV5 Advanced (Next: 300)
  • *****
  • Posts: 295
  • Rating: +20/-1
  • Its 0x1A4 somewhere
    • View Profile
Re: Basic or Assembly?
« Reply #9 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
« Last Edit: March 04, 2011, 09:26:55 pm by Broseph Radson »

Offline aeTIos

  • Nonbinary computing specialist
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3913
  • Rating: +184/-32
    • View Profile
    • wank.party
Re: Basic or Assembly?
« Reply #10 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.
« Last Edit: March 05, 2011, 08:26:07 am by aeTIos »
I'm not a nerd but I pretend:

Offline Deep Toaster

  • So much to do, so much time, so little motivation
  • Administrator
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 8217
  • Rating: +758/-15
    • View Profile
    • ClrHome
Re: Basic or Assembly?
« Reply #11 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.
« Last Edit: March 06, 2011, 03:57:53 pm by Deep Thought »




Offline aeTIos

  • Nonbinary computing specialist
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3913
  • Rating: +184/-32
    • View Profile
    • wank.party
Re: Basic or Assembly?
« Reply #12 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
I'm not a nerd but I pretend:

Offline ztrumpet

  • The Rarely Active One
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 5712
  • Rating: +364/-4
  • If you see this, send me a PM. Just for fun.
    • View Profile
Re: Basic or Assembly?
« Reply #13 on: March 06, 2011, 11:23:46 am »
That was really interesting for me, Deep.  Thank you! ;D

Offline calc84maniac

  • eZ80 Guru
  • Coder Of Tomorrow
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2906
  • Rating: +469/-17
    • View Profile
    • TI-Boy CE
Re: Basic or Assembly?
« Reply #14 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.
"Most people ask, 'What does a thing do?' Hackers ask, 'What can I make it do?'" - Pablos Holman