1
2#------------------------------------------------------------------------------
3# $File: acorn,v 1.8 2021/04/26 15:56:00 christos Exp $
4# acorn:  file(1) magic for files found on Acorn systems
5#
6
7# RISC OS Chunk File Format
8# From RISC OS Programmer's Reference Manual, Appendix D
9# We guess the file type from the type of the first chunk.
100         lelong              0xc3cbc6c5          RISC OS Chunk data
11>12       string              OBJ_                \b, AOF object
12>12       string              LIB_                \b, ALF library
13
14# RISC OS AIF, contains "SWI OS_Exit" at offset 16.
1516        lelong              0xef000011          RISC OS AIF executable
16
17# RISC OS Draw files
18# From RISC OS Programmer's Reference Manual, Appendix E
190         string              Draw                RISC OS Draw file data
20
21# RISC OS new format font files
22# From RISC OS Programmer's Reference Manual, Appendix E
230         string              FONT\0              RISC OS outline font data,
24>5        byte                x                   version %d
250         string              FONT\1              RISC OS 1bpp font data,
26>5        byte                x                   version %d
270         string              FONT\4              RISC OS 4bpp font data
28>5        byte                x                   version %d
29
30# RISC OS Music files
31# From RISC OS Programmer's Reference Manual, Appendix E
320         string              Maestro\r RISC OS music file
33>8        byte                x                   version %d
34
35>8        byte                x                   type %d
36
37# Digital Symphony data files
38# From: Bernard Jungen (bern8817@euphonynet.be)
390                   string    \x02\x01\x13\x13\x13\x01\x0d\x10        Digital Symphony sound sample (RISC OS),
40>8                  byte      x         version %d,
41>9                  pstring   x         named "%s",
42>(9.b+19) byte      =0        8-bit logarithmic
43>(9.b+19) byte      =1        LZW-compressed linear
44>(9.b+19) byte      =2        8-bit linear signed
45>(9.b+19) byte      =3        16-bit linear signed
46>(9.b+19) byte      =4        SigmaDelta-compressed linear
47>(9.b+19) byte      =5        SigmaDelta-compressed logarithmic
48>(9.b+19) byte      >5        unknown format
49
500         string    \x02\x01\x13\x13\x14\x12\x01\x0b        Digital Symphony song (RISC OS),
51>8        byte      x         version %d,
52>9        byte      =1        1 voice,
53>9        byte      !1        %d voices,
54>10       leshort   =1        1 track,
55>10       leshort   !1        %d tracks,
56>12       leshort   =1        1 pattern
57>12       leshort   !1        %d patterns
58
590         string    \x02\x01\x13\x13\x10\x14\x12\x0e
60>9        byte      =0        Digital Symphony sequence (RISC OS),
61>>8       byte      x         version %d,
62>>10      byte      =1        1 line,
63>>10      byte      !1        %d lines,
64>>11      leshort   =1        1 position
65>>11      leshort   !1        %d positions
66>9        byte      =1        Digital Symphony pattern data (RISC OS),
67>>8       byte      x         version %d,
68>>10      leshort   =1        1 pattern
69>>10      leshort   !1        %d patterns
70
71# From: Joerg Jenderek
72# URL: https://www.kyzer.me.uk/pack/xad/#PackDir
73# reference: https://www.kyzer.me.uk/pack/xad/xad_PackDir.lha/PackDir.c
74# GRR: line below is too general as it matches also "Git pack" in ./revision
750         string    PACK\0
76# check for valid compression method 0-4
77>5        ulelong   <5
78# https://www.riscosopen.org/wiki/documentation/show/Introduction%20To%20Filing%20Systems
79# To skip "Git pack" version 0 test for root directory object like
80# ADFS::RPC.$.websitezip.FONTFIX
81>>9       string    >ADFS\  PackDir archive (RISC OS)
82# TrID labels above as "Acorn PackDir compressed Archive"
83# compression mode y (0 - 4) for GIF LZW with a maximum n bits
84# (y~n,0~12,1~13,2~14,3~15,4~16)
85>>>5      ulelong+12 x        \b, LZW %u-bits compression
86# https://www.filebase.org.uk/filetypes
87# !Packdir compressed archive has three hexadecimal digits code 68E
88!:mime    application/x-acorn-68E
89!:ext     pkd/bin
90# null terminated root directory object like IDEFS::IDE-4.$.Apps.GRAPHICS.!XFMPdemo
91>>>9      string    x         \b, root "%s"
92# load address 0xFFFtttdd, ttt is the object filetype and dddddddddd is time
93>>>>&1    ulelong   x         \b, load address %#x
94# execution address 0xdddddddd dddddddddd is 40 bit unsigned centiseconds since 1.1.1900 UTC
95>>>>&5    ulelong   x         \b, exec address %#x
96# attributes (bits: 0~owner read,1~owner write,3~no delete,4~public read,5~public write)
97>>>>&9    ulelong   x         \b, attributes %#x
98# number of entries in this directory. for root dir 0
99#>>>&13   ulelong   x         \b, entries %#x
100# the entries start here with object name
101>>>>&17   string    x         \b, 1st object "%s"
102
103