Skip to content
Marnanel Thurman edited this page Nov 23, 2024 · 10 revisions

Edna is the container file format for Avalot's saved games. It was designed to be forward and backward compatible, and to work seamlessly with future games. As it turned out, it was only used for Avalot. The filename extension is .ASG, for "Avvy saved game".

Avaricius had its own file format dna256, based around an array of 256 two-byte words. It was far too restrictive, so we developed something better. "Edna" stands for "extended DNA".

Structure

  • Offsets and lengths in this document are given in decimal numbers of bytes.
  • All strings are in Pascal format: that is, the first byte is the unsigned length, which is followed immediately by the string data; in Edna files, the remaining bytes are blanked to 0x54, or 177 decimal.
  • All strings are encoded in CP437, the native DOS character set; the first 128 codepoints of this are identical to ASCII.
  • All numbers are little-endian, and unsigned unless otherwise mentioned.

According to edna.pas, there are five blocks:

  1. 177 bytes of cruft at the beginning; ignored so you can print something if someone TYPEs the file, since ^Z caused the DOS command TYPE to stop reading. (This was common practice at the time.) However, bytes 11 to 14 inclusive may not be "Avvy", because this is the magic number for dna256.
  2. Edna header about the saving game; see below
  3. Edna header about the game state being saved; see below
  4. game-specific game state; see Saved games
  5. anything following this is ignored; in the original it has Thomas was here eighteen times, since I was 18 when I wrote that bit of the code. (Releases continued until I was 20, but the age count wasn't increased.)

However, Avalot in fact saves further significant information after the game-specific block, including sprite positions. See the article on saved games for more details.

Header about the game program that saved this file

field name bytes type notes
signature 9 magic number: 54 54 b1 30 01 75 b1 99 b1. See Numerical motifs
revision 2 enum always 2 (since 1==dna256
game 51 str long display name of game, e.g. "Lord Avalot d'Argent"
shortname 16 str short display name of game, e.g. "Avalot"
number 2 enum 2==Avalot
ver 2 int saving game version number times 100, so 1.00 would be 100
verstr 6 str saving game version, e.g. "1.00"
filename 13 str name of the executable to run in order to load this file, e.g. "AVALOT.EXE`; long filenames were still a thing of the future.
osbyte 1 enum source operating system
os 6 str source operating system

Enum for osbyte:

  1. DOS (the only one that got used)
  2. Windows
  3. OS/2
  4. Apple MacOS
  5. Commodore Amiga
  6. Atari ST
  7. Acorn Archimedes

Header about the game state that's being saved

field name bytes type notes
fn 9 str filename of this file, without the extension
d 1 int day of month, 1-based
m 1 int month of year, 1-based
y 2 int year
desc 41 str description
len 2 int length of the next block
saves 2 int number of times this game has been saved
cash 2 signed int currency balance (in Avalot, this is in pence)
money 21 str currency balance for display
points 2 int score

len bytes of game-specific data follow; see Saved games. Anything beyond that is ignored.

In the source

Edna's structure definitions ("edhead") are copy-and-pasted all over the place. But see particularly:

  • ENID.PAS is the library used in-game to read and write files. The name was just chosen because it's another old-fashioned girl's name that's four letters long and begins with E.
  • EDNA.PAS exists so that you can associate *.asg with EDNA.EXE in Windows 3.1, so Avalot (or whatever) would run and open the file you double-clicked. The documentation calls this program "Edna Bucket", i.e. "head in a bucket". EDNA.EXE also knows how to work with Avaricius savefiles seamlessly.

image

Real example

       0 1 2 3  4 5 6 7  8 9 a b  c d e f
0000b0   54540a b1750130 0002b199 726f4c14    TT.0.u......Lor<
0000c0 76412064 746f6c61 41276420 6e656772  >d Avalot d'Argen<
0000d0 b1b1b174 b1b1b1b1 b1b1b1b1 b1b1b1b1  >t...............<
0000e0 b1b1b1b1 b1b1b1b1 b1b1b1b1 06b1b1b1  >................<
0000f0 6c617641 b1b1746f b1b1b1b1 02b1b1b1  >Avalot..........<
000100 04008200 30332e31 56410ab1 544f4c41  >....1.30..AVALOT<
000110 4558452e 0301b1b1 b1534f44 657404b1  >.EXE....DOS...te<
000120 b1b17473 0b17b1b1 411607e8 74616b72  >st.........Arkat<
000130 20732761 20646e61 72756f79 6f6f7220  >a's and your roo<
000140 b1b1b16d b1b1b1b1 b1b1b1b1 b1b1b1b1  >m...............<
000150 fab1b1b1 1e000101 2f321000 74282036  >..........2/6 (t<
000160 27746168 30332073 b1b12964 0002      >hat's 30d)....

From the original docs

DNA is a substance found in molecules of all living objects. It defines who or what the object is (the size of its nose, the shape of its leaves, etc.) When I wrote Avaricius, I called the save files DNA in the code, because they defined the state of the game exactly.

With Avalot, I made several changes, including rewriting the entire prehistoric DNA system. The new system I called Extended DNA. I then suddenly realised that E-DNA spells EDNA. So that's what I called it.

How does this affect you? Well, Edna is designed so that whichever Avvy game you're playing (Avaricius, Avalot, or any other one we write) it will say in the file which game it came from. If you play more than one Avvy game often, you'll probably build up a library of .ASG files. Every good library needs a librarian, so here she is: Edna Bucket!

Edna Bucket is a program called EDNA.EXE. If you run Edna with the filename of an .ASG file, she'll find the game it came from, load that game, and load the file in for you. Easy as anything. If you use Windows, 4-DOS, or any other system that allows file association, associate your .ASG files with EDNA.EXE, and then they'll always be loaded into the right game.

To associate .ASG files with EDNA: Load File Manager (from Program Manager, select Window | Main and then double-click on the icon of a filing cabinet). When File Mangler (oops, Manager) has loaded, click ONCE on an .ASG file somewhere, then choose File | Associate... and put the path to Edna (such as C:\AVALOT\EDNA.EXE) in the filename box.

The filenames of the games are stored in a file called EDNA.DAT. It looks like this:

Name of game Path to that game Name of another game Path to THAT game and so on

For example:

Avaricius
c:\games\avvy\avvy.exe
Avalot
N:\PUBLIC\GAMES\AVALOT\AVALOT.EXE

If an .ASG file belongs to a game that isn't listed in this file, Edna will ask you about it and then add the information. If you want to change it later, use a text editor (such as EDIT or EDLIN) to make the changes.

Edna has two switches:

 /i   prints some (I)nteresting (I)nformation about the game
  on the screen, but does *not* load anything.

 /q   stops the "Loading" message appearing.

So, for example:

EDNA /i TREE

gives information about the file TREE.ASG, and

EDNA /q elephant

loads the file ELEPHANT.ASG into the relevant game.
Clone this wiki locally