> >Executables can be tested via the FTYP function (type 1 is executable)
> >of Toolkit 2.
>
> Yes, they could also be identified (and some more interesting info gleaned)
> from the first couple of bytes, the executable header. Don't remember the
> definition of the top of my head, but I know hex 4AFB appears in it :-)
It's only a 'suggestion' (that most [commercial] programs obey), code
will still execute if it doesn't have this format - it's just that
extensions (like 'JOBS') will not be able to display any 'job name'.
When a program is EXEC'd it starts executing with the first byte of the
file. The suggestion was that the program should start:
00: xx xx xx xx xx xx xx 4A FB
08: LL LL nn nn nn nn nn nn nn
10: nn ....
where xx = executable code (usually it's just a BRA[.S] instruction =
$60 ..), LLLL = the length of the program name (.W, usually 00LL), nn =
the bytes of the name, eg:
00: 60 00 04 E0 00 00 4A FB �.....J.
08: 00 06 45 64 69 74 6F 72 ..Editor
10: 6D 64 76 32 5F 00 00 7E mdv2_..~
etc
is the start of my file editor. On 'JOBS', this appears as:
Job tag owner priority
0 0 0 32
4 5 0 s40 Editor
> Resident extensions cannot be recognized as they are just pieces of code,
> they are called after they are loaded (LRESPR), but don't have any defined
> headers etc.
Although there is no defined header, they usually start with code that
links the next names in and then exits, and looks something like:
00: 43 FA 00 0C LEA table,A1
04: 34 78 01 10 MOVE.W $0110,A2
08: 4E 92 JSR (A2)
0A: 70 00 MOVEQ #$00,D0
0C: 4E 75 RTS
10: 00 nn table DC.W 4 ; Number of PROCs
12: oo oo DC.W proc1-* ; offset to 1st proc code
14: 00 LL DC.W 5 ; length of name
16: 70 72 6F 63 49 DC.B 'proc1' ; name of 1st proc
1B: 00 ALIGN ; Words must be on even
boundaries
1C: ..... <rest of proc defn's>
Tho' the LEA and MOVE.W may be the other way round, in which case the
file will start:
00: 34 78 01 10 MOVE.W $0110,A2
04: 43 FA 00 08 LEA table,A1
But when you get to pure executable code as opposed to a job (eg the
Breakout game that came with the QL), there's no defined standard or
suggestion, so good luck.
Robert