Digital Video Forums  

Go Back   Digital Video Forums > Disc Formats > DVD Authoring and Editing

Reply
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
Old 19 Sep 2009, 09:16 AM   #1
Junior Member
Junior Member
 
Join Date: Feb 2007
Posts: 37
Default Interpret these Commands

Hi all, I can work my way through dvd commands but these ones I don't understand. Can someone please explain what these example instructions mean and how the result was achieved?

set gprm(4) =(mov) 268
if gprm(4) & 65280 then goto line 5 -> reply....(268 & 65280) : true
set gprm(6) =(mov) gprm(4) -> reply....gprm(6) = 268
set gprm(6) /=(div) 256 -> reply....gprm(6) = 1
set gprm(4) &=(and) 255 -> reply....gprm(4) = 12

Set gprm(0) =(mov) sprm(5:Title number in VTS) -> reply gprm(0) = 1
set gprm(0) *=(nul) 256 -> reply.... gprm(0) = 256
Set gprm(0) |=(or) sprm(7:Chapter number (or PGN)) -> reply gprm(0) = 257

It is the symbols I guess that need clarification and how to apply them but with the above example it sould shed some light on my problem.
ie, &; /=; &=; *=; l=;
I have also seen +; etc amongst others

Thankyou

Last edited by peterk; 19 Sep 2009 at 09:31 AM
peterk is offline   Reply With Quote
Old 19 Sep 2009, 01:34 PM   #2
Not a god of digital video
 
blutach's Avatar
 
Join Date: Oct 2004
Location: is everything!
Posts: 24,627
Default

  • The first command sets register 4 to be equal to 268
  • The second tests whether the value logically AND'ed with 65280 results in a non-zero number (it does and is equal to 256, so we branch to line 5).
  • The third copies the value in register 4 to register 6 overwriting what's in register 6 in the process.
  • The fourth divides what's in register 6 by 256. Since registers can only carry integers, the answer is 1 (in other words the remainder of 12 is ignored). I bet this sets the title number.
  • The next logically ANDs what's in register 4 (268) with 255 and results in 12 (I bet this sets the chapter number).
Quote:
Set gprm(0) =(mov) sprm(5:Title number in VTS) -> reply gprm(0) = 1
This copies the title number in the VTS (which is sprm(5)) to register 0. In this case, you are playing the first title in the VTS.
Quote:
set gprm(0) *=(mul) 256 -> reply.... gprm(0) = 256
This multiplies what's in register 0 by 256, to get an answer of 256.
Quote:
Set gprm(0) |=(or) sprm(7:Chapter number (or PGN)) -> reply gprm(0) = 257
This logically ORs what's in register 0 with the current chapter number. In this case, you are playing chapter 1 because the result is 257. If you were playing chapter 6, the result would be 262, etc.

Those symbols mean logical AND (in a conditional statement), divided by, AND (in a set statement), multiply and logical OR. But just use the mnemonics in PgcEdit for ease. It also pays to install the Hex bit operands plugin by M_Knox which makes understanding AND and OR operations a breeze. It's on the PgcEdit site or just click here.

Regards
__________________
Les

Essential progs - [PgcEdit] [VobBlanker] [MenuShrink] [IfoEdit] [Muxman] [DVD Remake Pro] [DVD Rebuilder] [BeSweet] [Media Player Classic] [DVDSubEdit] [ImgBurn]

Media and Burning - [Golden Rules of Burning] [Media quality] [Fix your DMA] [Update your Firmware] [What's my Media ID Code?] [How to test your disc]
[What's bitsetting?] [Burn dual layer disks safely] [Why not to burn with Ner0] [Interpret Ner0's burn errors] [Got bad playback?] [Burner/Media compatibility]

Cool Techniques - [2COOL's guides] [Clean your DVD] [Join a flipper] [Split into 2 DVDs] [Save heaps of Mb] [How to mock strip] [Cool Insert Clips]

Real useful info - [FAQ INDEX] [Compression explained] [Logical Remapping of Enabled Streams] [DVD-Replica] [Fantastic info on DVDs]


You should only use genuine Verbatim or Taiyo Yuden media. Many thanks to www.pcx.com.au for their supply and great service.

Explore the sites and the programs - there's a gold mine of information in them

Don't forget to play the Digital Digest Quiz!!! (Click here)


Last edited by blutach; 19 Sep 2009 at 02:06 PM
blutach is offline   Reply With Quote
Old 19 Sep 2009, 04:11 PM   #3
Junior Member
Junior Member
 
Join Date: Feb 2007
Posts: 37
Default

Thanks a lot blutach for making the time for the explanation
Studying your answer I can see that your assumption about the titles/chapters is correct

I assume that these instructions are based on binary math.

if gprm(4) & 65280 then goto line 5 -> reply....(268 & 65280) : true
This tests whether the value logically AND'ed with 65280 results in a non-zero number (it does and is equal to 256, so we branch to line 5).

binary for 65280 is.....and 268 is.....and the binary total is 256 as you said

01111111100000000 +
00000000100001100
--------------------
00000000100000000

Where did the value of 65280 come from do you think. (I'm looking at 13 chapters, no correllation here, I think)

Does the "&" function always have a True result for a non-zero answer. Won't the result always be non-zero unless it is AND'ed to 255 in this example?

In my navigation I can't see the significance of the values 255 and 256. Any insight?
peterk is offline   Reply With Quote
Old 19 Sep 2009, 04:38 PM   #4
Not a god of digital video
 
blutach's Avatar
 
Join Date: Oct 2004
Location: is everything!
Posts: 24,627
Default

65280 is decimal for the hex FF00. So what it is testing for is any bit higher than bit 7 (they start numbering at the right and this is called bit 0). So basically, it is looking for numbers higher than 255 and branching over a command if true.

Yes, AND is true is the result is non-zero, false otherwise.

Regards

Last edited by blutach; 19 Sep 2009 at 05:10 PM
blutach is offline   Reply With Quote
Old 19 Sep 2009, 04:46 PM   #5
Junior Member
Junior Member
 
Join Date: Feb 2007
Posts: 37
Default

I'll just take your word on that, thanks
peterk is offline   Reply With Quote
Old 20 Sep 2009, 04:45 PM   #6
Lord of Digital Video
Lord of Digital Video
 
r0lZ's Avatar
 
Join Date: Mar 2004
Location: be
Posts: 1,508
Default

It is frequent to find that kind of authoring in commercial DVDs. They store in the same GPRM the title number AND the chapter number:
Code:
Set gprm(0) =(mov) sprm(5:Title number in VTS)
set gprm(0) *=(nul) 256
Set gprm(0) |=(or) sprm(7:Chapter number (or PGN))
The title number is stored in gprm(0) and then gprm(0) is multiplied by 256 (0x100). That means that the title number occupies now the 8 upper bits of the gprm.
Finally, the chapter number is stored in the 8 lower bits of the gprm.

GPRM 0 can then be used to retrieve the title and chapter number, by doing the opposite:
Code:
set gprm(6) =(mov) gprm(0)
set gprm(6) /=(div) 256
set gprm(0) &=(and) 255
Since we need 2 values, it is necessary to copy the gprm containing the title and chapter numbers to a temporary gprm that will hold the title number. In this case, it's gprm(6).
Then, gprm 6 is divided by 256. Since it's an integer division, that has the effect to move the 8 upper bits to the 8 lower bits (and to clear the upper bits). Now, the title number is in gprm(6).
Finally, the 8 upper bits of the original gprm are cleared by the AND operation, to clear the title number, and leave only the chapter number.

The notation /=, *=, &=, |= etc., are common in the programming languages. The programmers are lazy people , and they prefer to write short lines of code. So, for example, "X /= 256" is equivalent to "x = x / 256". Similarly, in PgcEdit, "set gprm(0) /=(div) 256" means "set gprm(0) = gprm(0) / 256".

As blutach has suggested, I highly recommend to install the hexbitoperands plugin, especially if you are not comfortable with decimal to hexadecimal conversions or with binary operations.
__________________
r0lZ
PgcEdit homepage (hosted by VideoHelp)
Unofficial mirror (in Poland)
r0lZ is offline   Reply With Quote
Old 24 Sep 2009, 03:59 PM   #7
Junior Member
Junior Member
 
Join Date: Feb 2007
Posts: 37
Default

Thanks to blutach and r0LZ for making this clear
peterk is offline   Reply With Quote
Old 26 Sep 2009, 09:58 AM   #8
Junior Member
Junior Member
 
Join Date: Feb 2007
Posts: 37
Default

Just to continue on the commands theme when setting gprm's and then if/goto's are to be executed I have noticed that some gprm's contain values in the 20's or 30's range of digits. It would serve the same purpose if values in the range 1-10 were to be used for example, after all, they are only branching instructions.

Is this just a convention so that it enables easy visibility whilst tracing or is there some standard that requires it this way?
peterk is offline   Reply With Quote
Old 26 Sep 2009, 02:16 PM   #9
Not a god of digital video
 
blutach's Avatar
 
Join Date: Oct 2004
Location: is everything!
Posts: 24,627
Default

Usually, but not always, the values reflect the (original) title numbers. There is no convention. Leave these alone!

Regards
blutach is offline   Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Graduating With Commands Phillip General Computing 1 7 Jan 2007 02:49 AM
New FAQ: How to interpret your burn error blutach DVD Blank Media, Burning, Recording Hardware 7 6 Nov 2005 04:43 PM
FAQ: How to interpret your burning error code blutach FAQ and Guides 0 5 Nov 2005 08:19 PM



All times are GMT +10. The time now is 05:48 PM.

Kirsch designed by Andrew & Austin


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright © 1999 - 2018 Digital Digest

Visit DivXLand   Visit dvdloc8.com