Advanced Authoring - VM Commands

All actions on DVD are driven by a special DVD command language also called virtual machine commands (VM). If you decided to create a DVD all by yourself (without an authoring application) it is simply not enough to place all the video files there, but you have to write a "program" or set of instructions to tell the DVD player how to start, what to do with the files, what to do when the files finish playing etc. And we didn't even started with menus yet....

Don't panic!
Knowledge of VM Commands is absolutely not required in order to work with DVD-lab PRO. You may simply skip all this nonsense and pretend VM Commands exist only in a parallel universe. In your nice and cozy universe, a DVD is built using only tiny boxes that you can link together in the Connections window. Hey, if you believe in this long enough it becomes the truth!

VM Introduction

The major task of any mainstream DVD authoring application is to hide as much as possible of this from the users. It is obvious why. Users would require a much deeper knowledge of the DVD structure to be able to do even simple task like playing a movie. A DVD authoring application has to create a flexible environment for the user yet it has to be smart enough to be able to translate all this flexibility into a playable VM command language. Because VM commands are a language, two similar DVD's that seems to behave the same way are very often created totally different way internally.

All the pages in this tutorial before this one talk about various way of linking "objects", "buttons" and various smart components. But what is hidden beneath this is in fact the difficult task of creating DVD structure and a "program" in DVD machine code that would perform what users visually designed.

A simple way of checking this is to open connection window, right click on a Menu to open the menu and select Edit VM Commands.

In the window that will open you will see in the DVD-lab dynamically added commands something like this:

1. GPRM12 = 1024
2. if (GPRM11 == 7) GPRM12 = 0
3. if (GPRM12 == 0) Goto 5
5. GPRM11 = 6
6. GPRM15 = 6

There are already some commands and we didn't make anything yet!

As you may see DVD-lab goes one step beyond standard DVD authoring. It allows you to not only see these commands but also add a new ones. For serious authors this is very important feature. No matter how smart you can make your authoring application, there is always something that it will not allow you to do easily or not at all. Having ability to edit VM commands opens a whole new range of possibilities. An example may be a DVD created for the testing of knowledge where you need to discover good and bad answers.

Places for VM commands

VM commands can be inserted in these places:

VM language

The DVD VM language has less than 40 instructions that can also be combined. A need to combine instructions comes from the fact that at some places DVD allows only one line of VM commands. A typical example are the VM commands on menu buttons.

PRE and POST commands

Commands on DVD can be in many places, but in most cases you will look for PRE and POST commands. The PRE command is the place before the object (Movie, Menu) plays and POST is just after the object is played.

DVD lab will enter its default PRE/POST commands to make all the links and features work and you can insert your own commands before them. This has advantage that if you don't want the DVD-lab commands to be executed, simply put a last line Break command.

The structure of any object would be like this:

Your Custom Commands
Your Custom Commands
DVD-lab added commands DVD-lab added commands

A VM Command window that appears when you select "Edit VM Commands" reflects this situation

Note about menus. Menus always execute PRE command when you go to the menu, but if you get out of the menu with a button, the POST command of menu is not executed, instead a Button VM Command (one line) assigned with the button is used. The POST command of menu is executed only if menu times out (or for non-looping motion or audio menu).

Chapter Commands

A movie can have a VM command on each chapter. These are also called cell commands. When you are in movie window, right click on a chapter point and from menu select Chapter VM Command...

Chapter command can be only one line.

Technical Note: If chapter has a VM command a short pause may occur on that spot during playback.

DVD Domains:

Objects and commands on DVD can be in a few different places called domains. We have:

If you want to know more about the structure, see appendix.

Variables (registers, GPRM, SPRM)

As with any language, VM commands have a few registers (or variables if you will) that can be used to read or store temporary values.

There are 16 GPRM registers (General Parameter) that can be freely used by DVD programmer and 24 SPRM registers (System Parameters) that are used to access information specific to DVD player (for example region of the player). You can't write to SPRM registers.

There are 16 registers GPRM0 - GPRM15, but as described before, DVD-lab creates its own VM code so the actions you design visually will work on DVD. In DVD-lab we tried to use the minimum number of registers for our internal purposes. These are registers GPRM11 to GPRM15 inclusive. Writing to these registers will make other parts of DVD-lab code (abstraction layer) not work correctly. In other words: DON'T touch!

We were very careful to use as few registers as possible so you can use the rest for your own programming needs.

DVD-lab reserved GPRM registers

GPRM11 Node, used to link Movie to particular VTS menu and for Menu button highlighting
GPRM12 Used for temporary in-command sequence data storage
GPRM13 Used to identify currently playing play lists*
GPRM14 Used as a counter in a Counter and Random list
GPRM15 Used for Return to last menu object

* GPRM13 is also used as a one-time flag to make sure DVD player starts with subtitles OFF.

You can freely use the registers GPRM0 ... GPRM10 for your own VM programming creations.

PGC Numbers

We will mention this on the following pages as well but it is vital to remember:

For VM Commands add 1 to the PGC number for all menus (VTS and VMG)

The first VTS menu that will shows in connections as ROOT is in DVD-lab PGCN 2.
There is always a shadow (hidden) menu for each VTS (PGCN 1) that has a special purpose*. To see its VM commands, right click in the Project window and from menu select VTS Root VM...

The first VMG menu that will shows in connections as TITLE is in DVD-lab PGCN 2.
There is always a shadow (hidden) menu (PGCN 1) before other visible VMG menus that has a special purpose*. To see its commands, in Connections right click on the Title Button and select Edit VM Commands.

You can instruct the Connection window to display the true PGC number above all objects instead of the item order by checking the Show PGC Number button. The PGC number appears in red in top left corner of object.
You can then use this number directly in VM Commands as PGC number

*This doesn't apply if you plan to Compile without Abstraction Layer. Without AL there will be no shadow menu created and therefore the first visible menu in DVD-lab will also become PGC 1 as expected