Scripting - what do the commands do?
This table is a copy of the work over at DVD-Replica.com. It is not the work of this site, and the information here is entirely theirs. The information has been adapted to be specific to DVD Studio Pro.
| Function | Description |
| Mov - Assign a value | Assign to a GPRM the value defined in a GPRM, an SPRM, or a constant value (immediate 16-bit number).
Example: 1) Mov GPRM0, GPRM1 (Copy the contents of GPRM1 to GPRM0) 2) Mov GPRM2, SPRM8 (Copy the contents of SPRM8 to GPRM2) 3) Mov GPRM0, 1024 (Initialize GPRM0 to 1024) |
| Swp - Swap two GPRMs | Swap the contents of two GPRMs.Example:
Swp GPRM0, GPRM7 (If GPRM0 has a value of 10 and GPRM7 has a value of 19, after this command executes, GPRM0 has a value of 19 and GPRM7 has a value of 10) |
| Add - addition | Add an immediate (16 bit) value to another GPRM or add the values of two GPRMs. SPRM values are not allowed as operands in this command.Example:
1) Add GPRM0, GPRM1 (Add the contents of GPRM1 and GPRM0 and save the result in GPRM0. The previous value of GPRM0 is lost after the command executes.) 2) Add GPRM0, 1024 (Add 1024 to the contents of GPRM0. If GPRM0 is 1, after the command |
| Sub - Subtraction | Subtract a constant value (immediate 16-bit number) or the content of another GPRM from the source GPRM. SPRM values are not allowed as operands in this command.Example:
1) Sub GPRM0, GPRM1 (Subtract the contents of GPRM1 from GPRM0 and saves the result in GPRM0. The previous value of GPRM0 is lost after the command executes.) 2) Sub GPRM0,1024 (Subtract 1024 from the contents of GPRM0. If GPRM0 is 1025, after the command executes, GPRM0 becomes 1) |
| Mul - Multiply (Product) | Compute the product (multiplication) of a GPRM or a constant value (immediate 16-bit number) with another GPRM. SPRM values are not allowed as operands in this command.Example:
1) Mul GPRM0, GPRM1 (Multiply the contents of GPRM1 and GPRM0 and save the result in GPRM0. The previous value of GPRM0 is lost after the command executes.) 2) Mul GPRM0, 2(Multiply the contents of GPRM0 with 2. If GPRM0 is 1024, after the command executes, GPRM0 becomes 2048) |
| Div
- Divide (Quotient) |
Compute the quotient (division) by dividing a GPRM with another GPRM or a constant value (immediate 16-bit number). SPRM values are not allowed as operands in this command.Example:
1) Div GPRM0, GPRM1 (Divide the contents of GPRM0 by the value in GPRM1 and save the result in GPRM0. The previous value of GPRM0 is lost after the command executes.) 2) Div GPRM0,2 (Divide the contents of GPRM0 with 2. If GPRM0 is 1024, after the command executes, GPRM0 becomes 512) |
| Mod - Remainder (Modulo) | Compute the remainder (modulo) by dividing a GPRM with another GPRM or a constant value (immediate 16-bit number). SPRM values are not allowed as operands in this command.Example:
1) Mod GPRM0, GPRM1(Modulo the contents of GPRM0 with the value in GPRM1 and save the result in GPRM0. The previous value of GPRM0 is lost after the command executes.) 2) Mod GPRM0, 2 (Compute the remainder by dividing the contents of GPRM0 by 2. If GPRM0 is an even number such as 8, after the command executes, GPRM0 becomes 0. If GPRM0 is an odd number such as 3, after the command executes, GPRM0 becomes 1). Remember, if you ‘mod’ by any number, the result could be zero, so ‘mod 6′ will return six possible values, including zero through to five. |
| Ran - Random value | Compute a new random value using the contents of a GPRM or a constant value (immediate 16-bit number) as the seed value. The seed value cannot be 0. SPRM is not allowed as operands in this command.Example:
1) Ran GPRM0, GPRM1 (Store a new random value in GPRM0 using the contents of GPRM1 as the seed value. The previous value of GPRM0 is lost after the command executes.) 2) Ran GPRM0, 65535 (Store a new random value in GPRM0 using 65,535 as the seed value - a result between 1 and 65,535 will occur) |
| AND - Logical AND | Compute the logical AND of a GPRM with another GPRM or a constant value (immediate 16-bit number). A logical AND of two bits yields a value of 0 if either bit is 0 and yields a value of 1 if both bits are 1. SPRM values are not allowed as operands in this command.Example:
1) And GPRM0, GPRM1 (Perform a logical AND of the contents of GPRM0 and GPRM1 and save the result in GPRM0. The previous value of GPRM0 is lost after the command executes.) (Perform a logical AND of the contents of GPRM0 and 255 and saves the result in GPRM0. This command effectively masks all but the first eight bits of GPRM0, making the remainder of the GPRM bits be zero.) If GPRM0 holds a value of 294, using AND GPRM0, 15 will give you a result of 6 (or 0110 in binary) - the lowest four bits in that register. All other bits become zero, so the value in the GPRM effectively reduces to 6. |
| OR - Logical OR | Compute the logical OR of a GPRM with another GPRM or a constant value (immediate 16-bit number). A logical OR of two bits yields a value of 1 if either bit is 1 and yields a value of 0 if both bits are 0. SPRM values are not allowed as operands in this command.Example:
1) Or GPRM0, GPRM1 (Perform a logical OR of the contents of GPRM0 and GPRM1 and save the result in GPRM0. The previous value of GPRM0 is lost after the command executes.) (Perform a logical OR of the contents of GPRM0 and 255 and save the result in GPRM0. This command effectively sets the least significant 8 bits of GPRM0 to all 1s if there was nothing in the GPRM to start with and leaves the upper 8 bits of GPRM0 unchanged) |
| XOR - Logical XOR | Compute the logical XOR of a GPRM with another GPRM or a constant value (immediate 16-bit number).A logical XOR of two bits yields a value of 0 if both bits are same and yields a value of 1 otherwise. SPRM values are not allowed as operands in this command.
Example: 1) Xor GPRM0, GPRM1 (Perform a logical XOR of the contents of GPRM0 and GPRM1 and save the result in GPRM0. The previous value of GPRM0 is lost after the command executes.) (Perform a logical XOR of the contents of GPRM0 and 255 and save the result in GPRM0. This command effectively inverts the least significant 8 bits of GPRM0 and leaves the upper 8 bits of GPRM0 unchanged) |
