ZX Format #07: Technical Details of Mod File Format

Article authors

Mentioned people

Mod File Format

music by MIDISOFT
(C) Stinger '& TP 1997

1. Title of the composition
2. Instrument headers
3. Position table and module information
4. Patterns
5. Samples

1. Title of the composition

Offset Length

+0 20
Title of the composition, maximum length 20 characters. If the title consists of less than 20 characters, the remaining part of this field will be filled with binary zeros. The offset is counted from the beginning of the file.

2. Instrument headers

Here are sequentially located 31 headers, each header is 30 (#1E) bytes long, i.e., the offsets of the headers relative to the beginning of the file will be as follows:
Header 1 - offset +20 (#14)
Header 2 - offset +50 (#32)
.
Header 31 - offset +920 (#398)

The offsets listed below are offsets relative to the beginning of the header.

Offset Length

+0 22
Instrument name, maximum length 22 characters. If the name consists of less than 22 characters, the remaining part of this field will be filled with binary zeros.
+22 2
Sample length - length of the sample (*). A value of 0 or 1 in this field indicates an empty sample (i.e., if the length of the sample in bytes is less than or equal to 2, then the sample is empty). A larger value indicates a sample that is actually present.
+24 1
The lower 4 bits represent the finetune value for the sample. The value ranges from -8 to +7. The upper 4 bits should be ignored when reading, and when writing, they should be set to zero.
Byte: Finetune values:

x0 0
x1 +1
x2 +2
x3 +3
x4 +4
x5 +5
x6 +6
x7 +7
x8 -8
x9 -7
xA -6
xB -5
xC -4
xD -3
xE -2
xF -1

One finetune unit equals 1/8 of a semitone, i.e., this parameter can lower the sample's frequency by a semitone or raise it by 7/8 of a semitone.
+25 1
Default instrument volume. The value ranges from 0 to 64 (#00..#40), where 64 is maximum volume and 0 is minimum.
+26 2
Repeat offset - the start of the repeat point in the instrument (*). This offset is relative to the beginning of the sample. This value is meaningful if the length of the repeating part (offset +28) is greater than zero.
+28 2
Repeat length - length of the repeating part (*). The sample is looped if and only if this value is greater than zero. (*) These values are measured in words and stored in the standard Amiga High-Endian format, so to interpret these values correctly, the following actions are required:

a) swap the high and low halves of the word;
b) multiply the word by two

LD HL,(32768+20+22) ; Length of the first sample in Amiga words
LD A,H ; (if the module is loaded at address 32768)
LD H,L
LD L,A
ADD HL,HL ; Now we have the length of the sample in bytes

The sample is played as follows:
1) if the length of the sample is less than two, then nothing is played;
2) then the length of the repeating part is analyzed: if it is greater than zero, then the sample is looped, and if it is zero, then it is not looped.
3) the non-looped sample is played simply from start to finish, i.e., from Sample_start_address to Sample_start_address+Sample_Length (Sample_start_address - address of the start of the sample).
4) the looped sample is played more complexly: at first, it plays from Sample_start_address to Sample_start_address + Repeat_offset + Repeat_Length, and then infinitely from Sample_start_address + Repeat_offset to Sample_start_address + Repeat_offset + Repeat_Length.

3. Position table and module information

Offset Length

+950(#3B6) 1
Length of the composition in positions (Song Positions) The value ranges from 1 to 128
+951(#3B7) 1
Position to which the player should jump at the end of the module playback. This allows for looping the module. If this value is greater than the number of positions, the player should stop at the end of the module playback. If looping the module is not required, it is recommended to write the value 127 in this field.
+952(#3B8) 128
Position table. The length of the table ranges from 1 to 128 (determined by the value at offset +950) The position number is an index in the table, and the value in the table at this index will be the pattern number. This table can be used to determine the number of patterns in the module. To do this, it is necessary to find the maximum value in the table and add one to it - this will be the number of patterns.

Example:
(+950)= 6 length of the composition - 6 positions.
(+952)= 2,2,1,0,3,2,6,7
Position 1 - pattern 3
Position 2 - pattern 3
Position 3 - pattern 2
Position 4 - pattern 1
Position 5 - pattern 4

Contents of the publication: ZX Format #07

  • From the Authors
    Update on SMUC, distribution issues, and plans for future ZX Format issues. Authors address outdated SMUC info and distribution problems of ZF-6. Upcoming content includes game descriptions and new projects.
  • Аторы журнала
    Contact information and editorial team details for ZX-Format No.7. Provides mailing and electronic addresses, as well as contact phone numbers. Information on the availability of their website and specific contact instructions.
  • Содержание номера
    The article provides an overview of notable software releases on the St. Petersburg market for autumn. It also includes detailed descriptions of games, programming tips, and hardware projects. Interviews, philosophical tales, and reader letters enrich the issue.
  • Игрушки - Welcome
    An overview of software novelties for ZX Spectrum, including games like 'Los Angeles Drugs Bust' and 'Jungle Warfare'. Each game description provides insights into graphics, gameplay, and features. A variety of genres from action to strategy are covered, showcasing the diversity of software offerings.
  • Игрушки - Алешкин А.В.
    The article describes the game 'TAI-PAN' as an arcade-economic game set in the 19th-century East, focusing on trading and survival amidst pirates and danger. It details the gameplay mechanics, such as trading goods, managing finances, and navigating seas with different ships. Despite its engaging plot and interface, the game didn't achieve much popularity in Russia.
  • Игрушки - Soft
    A whimsical narrative in a fantastical world where colors converse with the Last, a character recounting tales of ancient humans, coders, and a mysterious past. The story explores themes of language, translation, and the creation of 'the Last' amidst fantastical beings like flying hippos and sea giraffes. It serves as a fictional narrative with humorous elements, blending science fiction with satire.
  • Игрушки - Alex ASP
    A parody on Tolkien's 'The Lord of the Rings' named 'Bored of the Rings' by Delta 4 is explored. The text references adaptations, humorous adventures of characters like Fordo and Bimbo, and differing versions from Delta 4 over the years. Anticipated prequels and correspondence excerpts with Delta 4's Fergus McNeill are mentioned.
  • Игрушки - Гил-Гелад
    The article provides a detailed guide on navigating the 3D Construction Kit interface for ZX Spectrum. It explains menu options for file management, game setup, and in-game conditions. Additionally, it covers object creation, editing, and logic implementation within the program.
  • Программистам - Дмитрий Рудовский
    The article concludes the description of BB commands and provides tips on their usage. It details the usage of the CLOCK command for time and alarm management on ZX Spectrum. Additionally, it explains the SORT command for array sorting and introduces new logical and mathematical functions.
  • Программистам - Angel
    Introduction to assembly programming for beginners, covering basic concepts and commands. Detailed explanation of processor registers and flags, with examples. Offers practical advice on transitioning from Basic to assembly language.
  • Программистам - GreenFort
    Discussion on fast calculations in assembler for tasks like vector graphics and astronomy. Describes procedures for binary division and multiplication, with examples for different byte sizes. Highlights the adaptability of these methods for increased precision.
  • Программистам - TP, Stinger
    Detailed technical description of the Mod file format for music composition on ZX Spectrum, focusing on structure and data offsets for title, instruments, and patterns.
  • Программистам - Research
    The article describes the capabilities and limitations of the Convert program, focusing on its use for converting images to the BMC format. It includes technical details about the program's functions, such as dithering methods, sprite and screen format output, and the removal of extraneous dots. Additionally, the article briefly discusses the source code of X-Color and its potential applications.
  • Обзор
    The article discusses the ENLiGHT'97 demo-party held in St. Petersburg on August 24, 1997, featuring platforms like Spectrum, Amiga, and PC. The event attracted around 1100 delegates, leading to overcrowding and technical issues, which caused the cancellation of the second day. Despite these issues, the event was generally enjoyable, and there is hope for another event in 1998.
  • Обзор
    Review of VideoFAIR exhibition in Manezh with highlights on video and audio equipment. Amiga-service and various companies showcased their technological advancements in video editing and broadcast systems. Notable innovations include 3D laser-scanned displays and professional audio solutions.
  • Железо - Nemo
    Discussion of KAY technology export to decentralize Spectrum production. Highlights potential benefits and challenges of local manufacturing. Emphasizes quality assurance and support systems.
  • Железо
    The article describes the development of a new Scorpion motherboard, focusing on enhancing graphics, speed, and compatibility with modern peripherals like IBM keyboards and mice. It introduces the GMX (Graphic Memory Extension) board, designed to upgrade existing Scorpion models to match the capabilities of the new motherboard. The GMX board offers significant improvements in memory, graphics, and processing speed, while maintaining compatibility with ZX Spectrum and Pentagon standards.
  • Железо
    The article provides a detailed overview of two popular audio amplifiers for ZX Spectrum users in St. Petersburg. It highlights the advantages and specifications of the 2 X 2W low-voltage amplifier and the 2 X 22W car amplifier. The article also includes a price list and ordering instructions through the 'Nemo' company.
  • Примьера
    The article describes the improvements and features of the Turbo Assembler version 1.1 for ZX Spectrum. It highlights the differences from version 1.0, such as bug fixes, screen size changes, and added features like line editor and syntax checking. It also details the memory allocation and provides a guide on using the editor and compiler functions.
  • Примьера - STS
    Description of the Riff Tracker MOD-editor for General Sound, its features, and functionalities. Provides detailed instructions on using editing and sample management. Notes on the current version limitations and expected improvements.
  • Примьера - Paul Atrides, Alex Noman
    Presentation of Oberon Creative Pack, consisting of ZX-WinWord and Sprite Cutter. ZX-WinWord is a text editor combining text and graphics with advanced features. Sprite Cutter allows sprite creation and manipulation in various formats.
  • Примьера
    Presentation of the second demo version of the game Headball by ZX-Masters, discussing its features and improvements since the first demo. The game offers two-player mode, four levels, three types of projectiles, various options, and computer difficulty settings. Availability of Turbo mode and enhanced synchronization and animation make it unique among other Spectrum games.
  • Интервью - Ruster
    Interview with Digital Reality about ongoing projects like DOOM and Paradise Lost. Discussion of challenges and progress in game development. Preview of their submissions for the ENLiGHT event.
  • Интервью - Ruster
    Interview with members of the newly formed group EXTREME. They work on demos for Spectrum and Amiga platforms and discuss their team members and activities. The interview also touches upon the state of the Amiga scene in Moscow.
  • Интервью - Борис Прытков
    Interview with Samara-based Spectrum enthusiasts discussing their achievements and challenges. Emphasis on community building and publication of Oberon magazine. Efforts to establish a Spectrum network and convert the game WALKER.
  • Интервью - Борис Прытков
    The article is an interview with members of the group Flash inc. discussing their projects for ZX Spectrum and PC, including a music editor with an innovative interface and a new multicolor graphic editor.
  • Интервью - Михаил Акимов
    Interview with Moscow-based group Progress discussing their current work on Spectrum demos, plans for future projects on Amiga, and opinions on the Russian demoscene.
  • Интервью - Михаил Акимов
    Interview with Felix about changes in the tech landscape, the enduring appeal of Amiga despite PC dominance, and his work on 'Winnie the Pooh - 2' for Spectrum.
  • Интервью - Ruster
    Interview with Slash about the ENLiGHT event, including sponsorship issues, attendee behavior, and the quality of music and demos. Discussion of the current state of the Spectrum and Amiga markets. Commentary on music trackers and the future of hardware development.
  • Интервью - Ruster
    Interview with V. Mednonogov after ENLiGHT'97 discussing impressions of the event, future of Spectrum, and his current project 'Black Raven'. Mednonogov shares his views on new hardware and software development and the importance of copyright. He also discusses his plans for upcoming projects and the challenges faced in game development.
  • Здесь был ты
    A satirical guide to gaining power and invisibility using magical rituals and Orbit gum.
  • Здесь был ты - Saggitarius
    A contemplative novella about a man's existential journey after encountering a mysterious individual offering a device called the Stop Crane. Through flashbacks, the protagonist reflects on his life, uniqueness, and his desire to break free from societal constraints. Ultimately, he faces the moral dilemma of using the Stop Crane to transcend time and existence.
  • Почта - Eagle Soft
    Critique of ZX-Spectrum software, highlighting the limitations of current programs and recommending the removal of outdated tools. Discussion on the limitations of assembly programs and the need for more efficient assemblers like M80. Evaluation of current music and graphic editors, with a focus on the redundancy of certain applications.
  • Почта
    Discussion of reader inquiries on ZX Format distribution and content. Responses include details on acquiring issues and technical insights on the KAY-256 computer. The magazine also addresses criticism of its market outlook article.
  • Почта
    This advertisement highlights XL Design Inc.'s software distribution campaign, offering games like 'Plutonia' and upcoming releases such as 'Mortal Kombat'. Mouse controllers are promoted with humorous selling points and pricing details. Studio LOGROS provides a wide range of software and peripherals, with options for local and remote purchases.
  • Разное - Александр Сысоев
    The article discusses the creation of an RPG game by the OBERON GROUP, inspired by 'Eye of Beholder'. It describes the game's humorous plot set in a distant galaxy and the battle against invaders on a planet named Agima. The team invites musicians, artists, coders, and scriptwriters for collaboration.
  • Разное - Viator
    The article describes the development of a new graphics editor called STATE OF THE ART for ZX Spectrum, aiming to improve upon existing editors like ART-STUDIO and ARTIST-2. The team AVALON, inspired by feedback from the SPECCY artist community, incorporates features from editors on Amiga and PC, while also addressing specific user requests. Key features include a user-friendly interface, enhanced magnify mode, advanced shape and window manipulation, and optimized performance.
  • Разное
    Discussion on enhancing consumer quality of Spectrum computers without altering their technical specifications. Suggestions include improving existing support, developing platform ideology, and structural changes. The article also touches on the potential of electronic books and their commercial viability.
  • Amiga Club - Максим Петров
    The article describes the author's admiration for the Amiga computer, emphasizing its aesthetic and technical merits compared to other platforms. It explores the author's programming experiences on Amiga, highlighting its efficiency and the impressive capabilities of its new hardware upgrades. The article concludes by reflecting on the unique community and passion of Amiga enthusiasts.