SCUMM Disk Format
by Brian Bagnall
In order to construct a proper SCUMM editor, it must be able to read room data (scripts, etc...) from the original Zak or MM disk, modify it, then rewrite it to a 1541 disk. The actual file the SCUMM editor will use is a .d64 file, which is 174,848 bytes in size. (This file can then be written to an actual 5 1/4" floppy disk using an XE1541 cable, or the file can be used directly in a C64 emulator.)
The original C64 Maniac Mansion came on one disk, with the program/data on side one and more data on side two. Zak McKracken came on two disks, and used three sides of those disks. There is a boot disk, which only has a single executable file, and the data disk. All we are interested in is the data disk - side one and two.
Standard Disk Format
(taken from the Commodore user manual)
Here is the format of a regular 1541 disk:
256 bytes per sector (sector = block)
683 sectors/blocks per disk
There are 35 tracks on a disk.
Each track has between 17 and 21 sectors. ie Outer tracks have more sectors than inner because of difference in circumferance of round disk.
Track 1-17 has 21 sectors
18-24 has 19
25-30 has 18
31-35 has 17
This comes to 174,848 bytes total
Here is the format of the directory information of a standard 1541 disk:
Normally 1541 disks store directory info on track 18 (19 blocks used - ie 4,864 bytes)
In hex editor, the data located at bytes 91,392 through 96,255
91,392 to 91,535 stores the BAM
91,536 to 96,255 stores the file indexes
It can store a maximum of 144 files
The Lucasarts data disks use a different, unknown format that does not store the directory information on track 18. The Zak McKracken data disks are not in the standard File Format! Here is what we know about it so far:
SCUMM may use track 25 for file info because in the Vice emulator it seems to check track 25 when accessing a new room.
Possible Strategies
Maybe there is no index. Maybe you just tell it which side of the disk it is on, and each room is allocated the same amount of disk space (highly unlikely!)
On the PC, all this data is in the 00.lfl file. On the C64, the data is VERY similar but different (see screenshot). Try to understand the 00.lfl format, then see what it means on the C64.
if the file pointer data is written on the same track and sector on disk 1 and 2, then a program to compare the data and find identical data will point out where this data is located.
Possibly this data is on the boot disk and stored in memory at all times?
Look at all the file space used by rooms. The leftover file space must have the file pointer data. Search this space.
How to manually pull a room file
Here's how you figure out exactly where the room starts:
- Look at disk 1, at location 0x500. The data reads:
0x500: D1 0A 00 9D 28 11 00 0E ...
The first two pair of bytes are, I think, the offset to the init or main script of the room. The second two pairs = unknown?
- But here's the beef: 28 11 <- room width, room height
40x17 tiles
- all rooms have 11 as height, while most rooms have 40 (except for the ones that scroll)
but they're either 0x28, 0x50 or 0xA0 (iirc)
so they're pretty easy to spot
- Maniac Mansion has 52 .lfl files (rooms) are on both sides. On disk one it lists which side it's on. 14 on side 1, 38 on side 2.
- Zak has 58 rooms. The disk even lists them all at the start. It reads exactly:
2222222222222221222222222222212112222221112211111211
- Right after this is a table of numbers, starting at about 316. These have the track number of the lfl file, followed by the sector number that it starts at. The first word of the lfl file is the length of the file.
Is the Zak McKracken SCUMM Engine Backward Compatible with Maniac Mansion?
Since the scripting codes are the same, I thought I'd test to see if the Zak core engine could run the MM data. When Zak loads it says to insert disk 1, so I tried inserting the MM disk 1 instead. The program started loading data, then it asked me to insert disk __ [unknown characters]. Interesting...
The Zak McKracken Rooms
For the heck of it, I started listing the rooms and where they are found on the Zak McKracken disks.
PC File: Room: Track:
01.lfl Front of House 1
02.lfl Bottom of Pool
03.lfl Living Room 3
04.lfl Dungeon
05.lfl Library
06.lfl Pool
07.lfl Kitchen 9
08.lfl
09.lfl
10.lfl
11.lfl
12.lfl
13.lfl
14.lfl
15.lfl
16.lfl
17.lfl
18.lfl
19.lfl
20.lfl
21.lfl
22.lfl
23.lfl
24.lfl
25.lfl
26.lfl
27.lfl
28.lfl
29.lfl
30.lfl
31.lfl
32.lfl
33.lfl
34.lfl
35.lfl
36.lfl
37.lfl
38.lfl
39.lfl
40.lfl
41.lfl
42.lfl
43.lfl
44.lfl
45.lfl
46.lfl
47.lfl
48.lfl
49.lfl
50.lfl
51.lfl
52.lfl