02.07.2013 Views

Amiga Computing - Commodore Is Awesome

Amiga Computing - Commodore Is Awesome

Amiga Computing - Commodore Is Awesome

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

App,B p.40 - this version sacrifices<br />

rigour for readability):<br />

Ounk<br />

FCRM<br />

CAT<br />

LIST<br />

PROP<br />

/D 4( uPYTE* ) [0]<br />

::= 'FORM" 4( Type (Chunk I FORM<br />

::= 'CAT ' 4( Type (FORM I LIST I<br />

::= 'UST 4( Type PROP* (FORM I<br />

u. Type Chunk* I<br />

Note:<br />

[01 represents a pad byte which may<br />

be needed.<br />

# is a LONG type number stating the<br />

number of following {braced) bytes.<br />

* means 0 or more instances (it's not<br />

a C-language pointer).<br />

An equivalent syntax for the text<br />

version would read:<br />

Chunk<br />

FORN<br />

and so on...<br />

LIST I CAT)* ]<br />

CATI* )<br />

LIST CATI*<br />

ID 'I' CMAR* 9'<br />

q. Type (Chunk I FORM Lisr I CAT(' T<br />

Note that the pad bytes and byte<br />

counts have gone - alignment is<br />

unnecessary, and the delimiting braces<br />

now appear in the actual file, not just<br />

the syntax statement. Two cosmetic<br />

features have also been added -<br />

spaces and comments. They don't<br />

appear in the syntax diagram because<br />

they are skipped over at lexical analysis,<br />

before syntax analysis starts.<br />

Comments start with a semicolon, and<br />

extend to the end of the line on which<br />

they appear.<br />

This example shows a sample use of<br />

IFFanalyse on a generic - in other<br />

words unrecognised - form. This is how<br />

the example form would appear if listed<br />

using "list NBRS.iff opt h"<br />

0000: 464F5240 00000026 4E425253 413594C49 1B1I...iNFIRSKYLI<br />

0010: 00000008 01234567 89ADCDEF 497C0100<br />

0020: 4A41534E 00010005 03122937 5900 -<br />

T A S K i n<br />

IFFanalyse would show that this file is<br />

a FORM of type NBRS containing two<br />

chunks of type KYLI and JASN respectively.<br />

Chunk sizes are given (in decimal)<br />

as comments, and an Ascii representation<br />

of chunk contents is also given.<br />

FORMI HERS :size=38<br />

:eize=11<br />

01234567 89N3CCIEF 497CD1<br />

rsize=5<br />

03122937 59<br />

If you were to edit this text file you<br />

would only need to concern yourself<br />

with material before the semicolon in<br />

each line. IFFsynthesise will calculate<br />

chunk sizes from the amount of actual<br />

data between '-{" and ")" braces, so the<br />

fact that a size comment such as<br />

;size-38 "or Ascii comment such as'<br />

may no longer be correct after<br />

editing a file is unimportant.<br />

An output like the one above is better<br />

;.4Eq....II.<br />

A<br />

than nothing, but it suffers from one<br />

drawback - it reflects only the structure<br />

of the data, not its meaning. If you're<br />

working with 8SVX<br />

sampled sound files, or<br />

SMUS music files, you're<br />

in luck.<br />

IFFedit recognises<br />

these forms, and for each<br />

one it has a list of standard chunk types<br />

which receive special treatment. There<br />

is a separate list for each form type<br />

because chunk types are only reserved<br />

within a form type.<br />

A FORM AUTH chunk happens to be<br />

the same as an 8SVX AUTH, but<br />

there's no rule saying it has to be. In<br />

particular, I might treat an ILBM BODY<br />

- if I get round to supporting ILBM -<br />

quite differently from 8SVX<br />

BODY. Any addition made<br />

to IFFanalyse must be<br />

made to IFFsynthesise as<br />

well, otherwise IFFsynthesise will fail to<br />

recognise some mnemonic which has<br />

been used to represent data.<br />

An 8SVX chunk has eightstandard<br />

chunk types - VHDR, NAME, Copyright<br />

("(c) "), AUTH, ANNO, ATAK, RLSE and<br />

BODY. Descriptions of these can be<br />

found in the Exec manual App.0 pp.63-<br />

68, and are not given here.<br />

NAME, Copyright, AUTH and ANNO<br />

are treated as text, so a name chunk:<br />

4E414E145 00000006 73636F72 6532<br />

MAME_ •score2<br />

would appear as:<br />

NAME i ;size=6 ' s c o r e r [<br />

ATAK, RLSE and BODY<br />

are translated generically.<br />

A future version could give<br />

mnemonics for ATAK and<br />

RLSE chunks.<br />

VHDR has a special format:<br />

56484452 00000014 00000400 00000001<br />

00000000<br />

,<br />

6E19010<br />

0<br />

0 0 0 1<br />

0 0 0 0<br />

appears as:<br />

'VIER ( :size=20<br />

oneShot 1024<br />

repeat 0<br />

PerRi 0<br />

PerSec 28185 81<br />

octaves 1<br />

comp 0<br />

volune 65536<br />

Mnemonic names, for example.<br />

"PerSec" are not case-sensitive, but<br />

they must appear in the order given<br />

above, and the decimal numbers after<br />

them are size checked by<br />

IFFsynthesise.<br />

VHDR<br />

....n .......<br />

INJ<br />

Paul Holmes<br />

continues his<br />

look at the<br />

<strong>Amiga</strong>'s<br />

unique filing<br />

system, the<br />

IFF: This month<br />

- properties,<br />

chunks and a<br />

chance for you<br />

to experiment<br />

with file<br />

formats<br />

yourself<br />

Next month Paul looks at more<br />

examples where IFF can save<br />

you time and frustration. More<br />

chunks than a jar of orange<br />

marmalade!<br />

AMIGA comptrutx November 1990 117

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!