Mercurial > libdvdnav.hg
annotate vmcmd.c @ 138:5ce26c18c455 src
dvd_read_name can be static and does not need the whole vm_t*
author | mroi |
---|---|
date | Sat, 29 Mar 2003 12:21:15 +0000 |
parents | 5897ff629f7c |
children | 5ddb33e104a8 |
rev | line source |
---|---|
0 | 1 /* |
2 * Copyright (C) 2000, 2001 Martin Norbäck, Håkan Hjort | |
3 * | |
4 * This file is part of libdvdnav, a DVD navigation library. It is modified | |
5 * from a file originally part of the Ogle DVD player. | |
6 * | |
7 * libdvdnav is free software; you can redistribute it and/or modify | |
8 * it under the terms of the GNU General Public License as published by | |
9 * the Free Software Foundation; either version 2 of the License, or | |
10 * (at your option) any later version. | |
11 * | |
12 * libdvdnav is distributed in the hope that it will be useful, | |
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
15 * GNU General Public License for more details. | |
16 * | |
17 * You should have received a copy of the GNU General Public License | |
18 * along with this program; if not, write to the Free Software | |
19 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA | |
20 * | |
21 * $Id$ | |
22 * | |
23 */ | |
24 | |
25 #ifdef HAVE_CONFIG_H | |
26 #include "config.h" | |
27 #endif | |
28 | |
29 #include <stdio.h> | |
30 #include <ctype.h> | |
31 #include <inttypes.h> | |
11
1f479a99339c
Change the bits function so that there are no global variables left.
jcdutton
parents:
10
diff
changeset
|
32 #include <assert.h> |
0 | 33 |
76 | 34 #include "dvdnav_internal.h" |
0 | 35 |
36 | |
114 | 37 #ifdef TRACE |
38 | |
0 | 39 /* freebsd compatibility */ |
40 #ifndef PRIu8 | |
41 #define PRIu8 "d" | |
42 #endif | |
43 | |
44 /* freebsd compatibility */ | |
45 #ifndef PRIu16 | |
46 #define PRIu16 "d" | |
47 #endif | |
48 | |
49 static const char *cmp_op_table[] = { | |
50 NULL, "&", "==", "!=", ">=", ">", "<=", "<" | |
51 }; | |
52 static const char *set_op_table[] = { | |
53 NULL, "=", "<->", "+=", "-=", "*=", "/=", "%=", "rnd", "&=", "|=", "^=" | |
54 }; | |
55 | |
56 static const char *link_table[] = { | |
57 "LinkNoLink", "LinkTopC", "LinkNextC", "LinkPrevC", | |
58 NULL, "LinkTopPG", "LinkNextPG", "LinkPrevPG", | |
59 NULL, "LinkTopPGC", "LinkNextPGC", "LinkPrevPGC", | |
60 "LinkGoUpPGC", "LinkTailPGC", NULL, NULL, | |
61 "RSM" | |
62 }; | |
63 | |
64 static const char *system_reg_table[] = { | |
65 "Menu Description Language Code", | |
66 "Audio Stream Number", | |
67 "Sub-picture Stream Number", | |
68 "Angle Number", | |
69 "Title Track Number", | |
70 "VTS Title Track Number", | |
71 "VTS PGC Number", | |
72 "PTT Number for One_Sequential_PGC_Title", | |
73 "Highlighted Button Number", | |
74 "Navigation Timer", | |
75 "Title PGC Number for Navigation Timer", | |
76 "Audio Mixing Mode for Karaoke", | |
77 "Country Code for Parental Management", | |
78 "Parental Level", | |
79 "Player Configurations for Video", | |
80 "Player Configurations for Audio", | |
81 "Initial Language Code for Audio", | |
82 "Initial Language Code Extension for Audio", | |
83 "Initial Language Code for Sub-picture", | |
84 "Initial Language Code Extension for Sub-picture", | |
85 "Player Regional Code", | |
86 "Reserved 21", | |
87 "Reserved 22", | |
88 "Reserved 23" | |
89 }; | |
90 | |
91 static const char *system_reg_abbr_table[] = { | |
92 NULL, | |
93 "ASTN", | |
94 "SPSTN", | |
95 "AGLN", | |
96 "TTN", | |
97 "VTS_TTN", | |
98 "TT_PGCN", | |
99 "PTTN", | |
100 "HL_BTNN", | |
101 "NVTMR", | |
102 "NV_PGCN", | |
103 NULL, | |
104 "CC_PLT", | |
105 "PLT", | |
106 NULL, | |
107 NULL, | |
108 NULL, | |
109 NULL, | |
110 NULL, | |
111 NULL, | |
112 NULL, | |
113 NULL, | |
114 NULL, | |
115 NULL, | |
116 }; | |
117 | |
118 static void print_system_reg(uint16_t reg) { | |
119 if(reg < sizeof(system_reg_abbr_table) / sizeof(char *)) | |
76 | 120 fprintf(MSG_OUT, " %s (SRPM:%d)", system_reg_table[reg], reg); |
0 | 121 else |
76 | 122 fprintf(MSG_OUT, " WARNING: Unknown system register ( reg=%d ) ", reg); |
0 | 123 } |
124 | |
125 static void print_reg(uint8_t reg) { | |
126 if(reg & 0x80) | |
127 print_system_reg(reg & 0x7f); | |
128 else | |
129 if(reg < 16) | |
76 | 130 fprintf(MSG_OUT, " g[%" PRIu8 "]", reg); |
0 | 131 else |
76 | 132 fprintf(MSG_OUT, " WARNING: Unknown general register "); |
0 | 133 } |
134 | |
135 static void print_cmp_op(uint8_t op) { | |
136 if(op < sizeof(cmp_op_table) / sizeof(char *) && cmp_op_table[op] != NULL) | |
76 | 137 fprintf(MSG_OUT, " %s ", cmp_op_table[op]); |
0 | 138 else |
76 | 139 fprintf(MSG_OUT, " WARNING: Unknown compare op "); |
0 | 140 } |
141 | |
142 static void print_set_op(uint8_t op) { | |
143 if(op < sizeof(set_op_table) / sizeof(char *) && set_op_table[op] != NULL) | |
76 | 144 fprintf(MSG_OUT, " %s ", set_op_table[op]); |
0 | 145 else |
76 | 146 fprintf(MSG_OUT, " WARNING: Unknown set op "); |
0 | 147 } |
148 | |
11
1f479a99339c
Change the bits function so that there are no global variables left.
jcdutton
parents:
10
diff
changeset
|
149 static void print_reg_or_data(command_t* command, int immediate, int byte) { |
0 | 150 if(immediate) { |
15 | 151 int i = vm_getbits(command, (byte*8), 16); |
0 | 152 |
76 | 153 fprintf(MSG_OUT, "0x%x", i); |
0 | 154 if(isprint(i & 0xff) && isprint((i>>8) & 0xff)) |
76 | 155 fprintf(MSG_OUT, " (\"%c%c\")", (char)((i>>8) & 0xff), (char)(i & 0xff)); |
0 | 156 } else { |
15 | 157 print_reg(vm_getbits(command, ((byte + 1)*8), 8)); |
0 | 158 } |
159 } | |
160 | |
11
1f479a99339c
Change the bits function so that there are no global variables left.
jcdutton
parents:
10
diff
changeset
|
161 static void print_reg_or_data_2(command_t* command, int immediate, int byte) { |
0 | 162 if(immediate) |
76 | 163 fprintf(MSG_OUT, "0x%x", vm_getbits(command, ((byte*8)+1), 7)); |
0 | 164 else |
76 | 165 fprintf(MSG_OUT, "g[%" PRIu8 "]", vm_getbits(command, ((byte*8)+4), 4)); |
0 | 166 } |
167 | |
11
1f479a99339c
Change the bits function so that there are no global variables left.
jcdutton
parents:
10
diff
changeset
|
168 static void print_if_version_1(command_t* command) { |
15 | 169 uint8_t op = vm_getbits(command, 9, 3); |
0 | 170 |
171 if(op) { | |
76 | 172 fprintf(MSG_OUT, "if ("); |
15 | 173 print_reg(vm_getbits(command,24,8)); |
0 | 174 print_cmp_op(op); |
15 | 175 print_reg_or_data(command, vm_getbits(command, 8,1), 4); |
76 | 176 fprintf(MSG_OUT, ") "); |
0 | 177 } |
178 } | |
179 | |
11
1f479a99339c
Change the bits function so that there are no global variables left.
jcdutton
parents:
10
diff
changeset
|
180 static void print_if_version_2(command_t* command) { |
15 | 181 uint8_t op = vm_getbits(command, 9, 3); |
0 | 182 |
183 if(op) { | |
76 | 184 fprintf(MSG_OUT, "if ("); |
15 | 185 print_reg(vm_getbits(command, 48, 8)); |
0 | 186 print_cmp_op(op); |
15 | 187 print_reg(vm_getbits(command, 56, 8)); |
76 | 188 fprintf(MSG_OUT, ") "); |
0 | 189 } |
190 } | |
191 | |
11
1f479a99339c
Change the bits function so that there are no global variables left.
jcdutton
parents:
10
diff
changeset
|
192 static void print_if_version_3(command_t* command) { |
15 | 193 uint8_t op = vm_getbits(command, 9, 3); |
0 | 194 |
195 if(op) { | |
76 | 196 fprintf(MSG_OUT, "if ("); |
15 | 197 print_reg(vm_getbits(command, 20, 4)); |
0 | 198 print_cmp_op(op); |
15 | 199 print_reg_or_data(command, vm_getbits(command, 8, 1), 6); |
76 | 200 fprintf(MSG_OUT, ") "); |
0 | 201 } |
202 } | |
203 | |
11
1f479a99339c
Change the bits function so that there are no global variables left.
jcdutton
parents:
10
diff
changeset
|
204 static void print_if_version_4(command_t* command) { |
15 | 205 uint8_t op = vm_getbits(command, 9, 3); |
0 | 206 |
207 if(op) { | |
76 | 208 fprintf(MSG_OUT, "if ("); |
15 | 209 print_reg(vm_getbits(command, 12, 4)); |
0 | 210 print_cmp_op(op); |
15 | 211 print_reg_or_data(command, vm_getbits(command, 8, 1), 4); |
76 | 212 fprintf(MSG_OUT, ") "); |
0 | 213 } |
214 } | |
215 | |
11
1f479a99339c
Change the bits function so that there are no global variables left.
jcdutton
parents:
10
diff
changeset
|
216 static void print_special_instruction(command_t* command) { |
15 | 217 uint8_t op = vm_getbits(command, 12, 4); |
0 | 218 |
219 switch(op) { | |
220 case 0: /* NOP */ | |
76 | 221 fprintf(MSG_OUT, "Nop"); |
0 | 222 break; |
223 case 1: /* Goto line */ | |
76 | 224 fprintf(MSG_OUT, "Goto %" PRIu8, vm_getbits(command, 56, 8)); |
0 | 225 break; |
226 case 2: /* Break */ | |
76 | 227 fprintf(MSG_OUT, "Break"); |
0 | 228 break; |
229 case 3: /* Parental level */ | |
76 | 230 fprintf(MSG_OUT, "SetTmpPML %" PRIu8 ", Goto %" PRIu8, |
15 | 231 vm_getbits(command, 52, 4), vm_getbits(command, 56, 8)); |
0 | 232 break; |
233 default: | |
76 | 234 fprintf(MSG_OUT, "WARNING: Unknown special instruction (%i)", |
15 | 235 vm_getbits(command, 12, 4)); |
0 | 236 } |
237 } | |
238 | |
11
1f479a99339c
Change the bits function so that there are no global variables left.
jcdutton
parents:
10
diff
changeset
|
239 static void print_linksub_instruction(command_t* command) { |
15 | 240 int linkop = vm_getbits(command, 59, 5); |
241 int button = vm_getbits(command, 48, 6); | |
0 | 242 |
243 if(linkop < sizeof(link_table)/sizeof(char *) && link_table[linkop] != NULL) | |
76 | 244 fprintf(MSG_OUT, "%s (button %" PRIu8 ")", link_table[linkop], button); |
0 | 245 else |
76 | 246 fprintf(MSG_OUT, "WARNING: Unknown linksub instruction (%i)", linkop); |
0 | 247 } |
248 | |
11
1f479a99339c
Change the bits function so that there are no global variables left.
jcdutton
parents:
10
diff
changeset
|
249 static void print_link_instruction(command_t* command, int optional) { |
15 | 250 uint8_t op = vm_getbits(command, 12, 4); |
0 | 251 |
252 if(optional && op) | |
76 | 253 fprintf(MSG_OUT, ", "); |
0 | 254 |
255 switch(op) { | |
256 case 0: | |
257 if(!optional) | |
76 | 258 fprintf(MSG_OUT, "WARNING: NOP (link)!"); |
0 | 259 break; |
260 case 1: | |
11
1f479a99339c
Change the bits function so that there are no global variables left.
jcdutton
parents:
10
diff
changeset
|
261 print_linksub_instruction(command); |
0 | 262 break; |
263 case 4: | |
76 | 264 fprintf(MSG_OUT, "LinkPGCN %" PRIu16, vm_getbits(command, 49, 15)); |
0 | 265 break; |
266 case 5: | |
76 | 267 fprintf(MSG_OUT, "LinkPTT %" PRIu16 " (button %" PRIu8 ")", |
15 | 268 vm_getbits(command, 54, 10), vm_getbits(command, 48, 6)); |
0 | 269 break; |
270 case 6: | |
76 | 271 fprintf(MSG_OUT, "LinkPGN %" PRIu8 " (button %" PRIu8 ")", |
15 | 272 vm_getbits(command, 57, 7), vm_getbits(command, 48, 6)); |
0 | 273 break; |
274 case 7: | |
76 | 275 fprintf(MSG_OUT, "LinkCN %" PRIu8 " (button %" PRIu8 ")", |
15 | 276 vm_getbits(command, 56, 8), vm_getbits(command, 48, 6)); |
0 | 277 break; |
278 default: | |
76 | 279 fprintf(MSG_OUT, "WARNING: Unknown link instruction"); |
0 | 280 } |
281 } | |
282 | |
11
1f479a99339c
Change the bits function so that there are no global variables left.
jcdutton
parents:
10
diff
changeset
|
283 static void print_jump_instruction(command_t* command) { |
15 | 284 switch(vm_getbits(command, 12, 4)) { |
0 | 285 case 1: |
76 | 286 fprintf(MSG_OUT, "Exit"); |
0 | 287 break; |
288 case 2: | |
76 | 289 fprintf(MSG_OUT, "JumpTT %" PRIu8, vm_getbits(command, 41, 7)); |
0 | 290 break; |
291 case 3: | |
76 | 292 fprintf(MSG_OUT, "JumpVTS_TT %" PRIu8, vm_getbits(command, 41, 7)); |
0 | 293 break; |
294 case 5: | |
76 | 295 fprintf(MSG_OUT, "JumpVTS_PTT %" PRIu8 ":%" PRIu16, |
15 | 296 vm_getbits(command, 41, 7), vm_getbits(command, 22, 10)); |
0 | 297 break; |
298 case 6: | |
15 | 299 switch(vm_getbits(command, 40, 2)) { |
0 | 300 case 0: |
76 | 301 fprintf(MSG_OUT, "JumpSS FP"); |
0 | 302 break; |
303 case 1: | |
76 | 304 fprintf(MSG_OUT, "JumpSS VMGM (menu %" PRIu8 ")", vm_getbits(command, 44, 4)); |
0 | 305 break; |
306 case 2: | |
76 | 307 fprintf(MSG_OUT, "JumpSS VTSM (vts %" PRIu8 ", title %" PRIu8 |
15 | 308 ", menu %" PRIu8 ")", vm_getbits(command, 32, 8), vm_getbits(command, 24, 8), vm_getbits(command, 44, 4)); |
0 | 309 break; |
310 case 3: | |
76 | 311 fprintf(MSG_OUT, "JumpSS VMGM (pgc %" PRIu8 ")", vm_getbits(command, 17, 15)); |
0 | 312 break; |
313 } | |
314 break; | |
315 case 8: | |
15 | 316 switch(vm_getbits(command, 40, 2)) { |
0 | 317 case 0: |
76 | 318 fprintf(MSG_OUT, "CallSS FP (rsm_cell %" PRIu8 ")", |
15 | 319 vm_getbits(command, 32, 8)); |
0 | 320 break; |
321 case 1: | |
76 | 322 fprintf(MSG_OUT, "CallSS VMGM (menu %" PRIu8 |
15 | 323 ", rsm_cell %" PRIu8 ")", vm_getbits(command, 44, 4), vm_getbits(command, 32, 8)); |
0 | 324 break; |
325 case 2: | |
76 | 326 fprintf(MSG_OUT, "CallSS VTSM (menu %" PRIu8 |
15 | 327 ", rsm_cell %" PRIu8 ")", vm_getbits(command, 44, 4), vm_getbits(command, 32, 8)); |
0 | 328 break; |
329 case 3: | |
76 | 330 fprintf(MSG_OUT, "CallSS VMGM (pgc %" PRIu8 ", rsm_cell %" PRIu8 ")", |
15 | 331 vm_getbits(command, 17, 15), vm_getbits(command, 32, 8)); |
0 | 332 break; |
333 } | |
334 break; | |
335 default: | |
76 | 336 fprintf(MSG_OUT, "WARNING: Unknown Jump/Call instruction"); |
0 | 337 } |
338 } | |
339 | |
11
1f479a99339c
Change the bits function so that there are no global variables left.
jcdutton
parents:
10
diff
changeset
|
340 static void print_system_set(command_t* command) { |
0 | 341 int i; |
342 | |
15 | 343 switch(vm_getbits(command, 4, 4)) { |
0 | 344 case 1: /* Set system reg 1 &| 2 &| 3 (Audio, Subp. Angle) */ |
345 for(i = 1; i <= 3; i++) { | |
15 | 346 if(vm_getbits(command, ((2+i)*8), 1)) { |
0 | 347 print_system_reg(i); |
76 | 348 fprintf(MSG_OUT, " = "); |
15 | 349 print_reg_or_data_2(command, vm_getbits(command, 3, 1), 2 + i); |
76 | 350 fprintf(MSG_OUT, " "); |
0 | 351 } |
352 } | |
353 break; | |
354 case 2: /* Set system reg 9 & 10 (Navigation timer, Title PGC number) */ | |
355 print_system_reg(9); | |
76 | 356 fprintf(MSG_OUT, " = "); |
15 | 357 print_reg_or_data(command, vm_getbits(command, 3, 1), 2); |
76 | 358 fprintf(MSG_OUT, " "); |
0 | 359 print_system_reg(10); |
76 | 360 fprintf(MSG_OUT, " = %" PRIu8, vm_getbits(command, 40, 8)); /* ?? */ |
0 | 361 break; |
362 case 3: /* Mode: Counter / Register + Set */ | |
76 | 363 fprintf(MSG_OUT, "SetMode "); |
15 | 364 if(vm_getbits(command, 40, 1)) |
76 | 365 fprintf(MSG_OUT, "Counter "); |
0 | 366 else |
76 | 367 fprintf(MSG_OUT, "Register "); |
15 | 368 print_reg(vm_getbits(command, 44, 4)); |
0 | 369 print_set_op(0x1); /* '=' */ |
15 | 370 print_reg_or_data(command, vm_getbits(command, 3, 1), 2); |
0 | 371 break; |
372 case 6: /* Set system reg 8 (Highlighted button) */ | |
373 print_system_reg(8); | |
15 | 374 if(vm_getbits(command, 3, 1)) /* immediate */ |
76 | 375 fprintf(MSG_OUT, " = 0x%x (button no %d)", vm_getbits(command, 32, 16), vm_getbits(command, 32, 6)); |
0 | 376 else |
76 | 377 fprintf(MSG_OUT, " = g[%" PRIu8 "]", vm_getbits(command, 44, 4)); |
0 | 378 break; |
379 default: | |
76 | 380 fprintf(MSG_OUT, "WARNING: Unknown system set instruction (%i)", |
15 | 381 vm_getbits(command, 4, 4)); |
0 | 382 } |
383 } | |
384 | |
11
1f479a99339c
Change the bits function so that there are no global variables left.
jcdutton
parents:
10
diff
changeset
|
385 static void print_set_version_1(command_t* command) { |
15 | 386 uint8_t set_op = vm_getbits(command, 4, 4); |
0 | 387 |
388 if(set_op) { | |
15 | 389 print_reg(vm_getbits(command, 24, 8)); /* FIXME: This is different from decoder.c!!! */ |
0 | 390 print_set_op(set_op); |
15 | 391 print_reg_or_data(command, vm_getbits(command, 3, 1), 4); |
0 | 392 } else { |
76 | 393 fprintf(MSG_OUT, "NOP"); |
0 | 394 } |
395 } | |
396 | |
11
1f479a99339c
Change the bits function so that there are no global variables left.
jcdutton
parents:
10
diff
changeset
|
397 static void print_set_version_2(command_t* command) { |
15 | 398 uint8_t set_op = vm_getbits(command, 4, 4); |
0 | 399 |
400 if(set_op) { | |
15 | 401 print_reg(vm_getbits(command, 12, 4)); |
0 | 402 print_set_op(set_op); |
15 | 403 print_reg_or_data(command, vm_getbits(command, 3, 1), 2); |
0 | 404 } else { |
76 | 405 fprintf(MSG_OUT, "NOP"); |
0 | 406 } |
407 } | |
408 | |
11
1f479a99339c
Change the bits function so that there are no global variables left.
jcdutton
parents:
10
diff
changeset
|
409 void vmPrint_mnemonic(vm_cmd_t *vm_command) { |
1f479a99339c
Change the bits function so that there are no global variables left.
jcdutton
parents:
10
diff
changeset
|
410 command_t command; |
1f479a99339c
Change the bits function so that there are no global variables left.
jcdutton
parents:
10
diff
changeset
|
411 command.instruction =( (uint64_t) vm_command->bytes[0] << 56 ) | |
1f479a99339c
Change the bits function so that there are no global variables left.
jcdutton
parents:
10
diff
changeset
|
412 ( (uint64_t) vm_command->bytes[1] << 48 ) | |
1f479a99339c
Change the bits function so that there are no global variables left.
jcdutton
parents:
10
diff
changeset
|
413 ( (uint64_t) vm_command->bytes[2] << 40 ) | |
1f479a99339c
Change the bits function so that there are no global variables left.
jcdutton
parents:
10
diff
changeset
|
414 ( (uint64_t) vm_command->bytes[3] << 32 ) | |
1f479a99339c
Change the bits function so that there are no global variables left.
jcdutton
parents:
10
diff
changeset
|
415 ( (uint64_t) vm_command->bytes[4] << 24 ) | |
1f479a99339c
Change the bits function so that there are no global variables left.
jcdutton
parents:
10
diff
changeset
|
416 ( (uint64_t) vm_command->bytes[5] << 16 ) | |
1f479a99339c
Change the bits function so that there are no global variables left.
jcdutton
parents:
10
diff
changeset
|
417 ( (uint64_t) vm_command->bytes[6] << 8 ) | |
1f479a99339c
Change the bits function so that there are no global variables left.
jcdutton
parents:
10
diff
changeset
|
418 (uint64_t) vm_command->bytes[7] ; |
1f479a99339c
Change the bits function so that there are no global variables left.
jcdutton
parents:
10
diff
changeset
|
419 command.examined = 0; |
0 | 420 |
15 | 421 switch(vm_getbits(&command,0,3)) { /* three first bits */ |
0 | 422 case 0: /* Special instructions */ |
11
1f479a99339c
Change the bits function so that there are no global variables left.
jcdutton
parents:
10
diff
changeset
|
423 print_if_version_1(&command); |
1f479a99339c
Change the bits function so that there are no global variables left.
jcdutton
parents:
10
diff
changeset
|
424 print_special_instruction(&command); |
0 | 425 break; |
426 case 1: /* Jump/Call or Link instructions */ | |
15 | 427 if(vm_getbits(&command,3,1)) { |
11
1f479a99339c
Change the bits function so that there are no global variables left.
jcdutton
parents:
10
diff
changeset
|
428 print_if_version_2(&command); |
1f479a99339c
Change the bits function so that there are no global variables left.
jcdutton
parents:
10
diff
changeset
|
429 print_jump_instruction(&command); |
0 | 430 } else { |
11
1f479a99339c
Change the bits function so that there are no global variables left.
jcdutton
parents:
10
diff
changeset
|
431 print_if_version_1(&command); |
1f479a99339c
Change the bits function so that there are no global variables left.
jcdutton
parents:
10
diff
changeset
|
432 print_link_instruction(&command, 0); /* must be pressent */ |
0 | 433 } |
434 break; | |
435 case 2: /* Set System Parameters instructions */ | |
11
1f479a99339c
Change the bits function so that there are no global variables left.
jcdutton
parents:
10
diff
changeset
|
436 print_if_version_2(&command); |
1f479a99339c
Change the bits function so that there are no global variables left.
jcdutton
parents:
10
diff
changeset
|
437 print_system_set(&command); |
1f479a99339c
Change the bits function so that there are no global variables left.
jcdutton
parents:
10
diff
changeset
|
438 print_link_instruction(&command, 1); /* either 'if' or 'link' */ |
0 | 439 break; |
440 case 3: /* Set General Parameters instructions */ | |
11
1f479a99339c
Change the bits function so that there are no global variables left.
jcdutton
parents:
10
diff
changeset
|
441 print_if_version_3(&command); |
1f479a99339c
Change the bits function so that there are no global variables left.
jcdutton
parents:
10
diff
changeset
|
442 print_set_version_1(&command); |
1f479a99339c
Change the bits function so that there are no global variables left.
jcdutton
parents:
10
diff
changeset
|
443 print_link_instruction(&command, 1); /* either 'if' or 'link' */ |
0 | 444 break; |
445 case 4: /* Set, Compare -> LinkSub instructions */ | |
11
1f479a99339c
Change the bits function so that there are no global variables left.
jcdutton
parents:
10
diff
changeset
|
446 print_set_version_2(&command); |
76 | 447 fprintf(MSG_OUT, ", "); |
11
1f479a99339c
Change the bits function so that there are no global variables left.
jcdutton
parents:
10
diff
changeset
|
448 print_if_version_4(&command); |
1f479a99339c
Change the bits function so that there are no global variables left.
jcdutton
parents:
10
diff
changeset
|
449 print_linksub_instruction(&command); |
0 | 450 break; |
451 case 5: /* Compare -> (Set and LinkSub) instructions */ | |
11
1f479a99339c
Change the bits function so that there are no global variables left.
jcdutton
parents:
10
diff
changeset
|
452 print_if_version_4(&command); |
76 | 453 fprintf(MSG_OUT, "{ "); |
11
1f479a99339c
Change the bits function so that there are no global variables left.
jcdutton
parents:
10
diff
changeset
|
454 print_set_version_2(&command); |
76 | 455 fprintf(MSG_OUT, ", "); |
11
1f479a99339c
Change the bits function so that there are no global variables left.
jcdutton
parents:
10
diff
changeset
|
456 print_linksub_instruction(&command); |
76 | 457 fprintf(MSG_OUT, " }"); |
0 | 458 break; |
459 case 6: /* Compare -> Set, always LinkSub instructions */ | |
11
1f479a99339c
Change the bits function so that there are no global variables left.
jcdutton
parents:
10
diff
changeset
|
460 print_if_version_4(&command); |
76 | 461 fprintf(MSG_OUT, "{ "); |
11
1f479a99339c
Change the bits function so that there are no global variables left.
jcdutton
parents:
10
diff
changeset
|
462 print_set_version_2(&command); |
76 | 463 fprintf(MSG_OUT, " } "); |
11
1f479a99339c
Change the bits function so that there are no global variables left.
jcdutton
parents:
10
diff
changeset
|
464 print_linksub_instruction(&command); |
0 | 465 break; |
466 default: | |
76 | 467 fprintf(MSG_OUT, "WARNING: Unknown instruction type (%i)", vm_getbits(&command, 0, 3)); |
0 | 468 } |
469 /* Check if there still are bits set that were not examined */ | |
11
1f479a99339c
Change the bits function so that there are no global variables left.
jcdutton
parents:
10
diff
changeset
|
470 |
1f479a99339c
Change the bits function so that there are no global variables left.
jcdutton
parents:
10
diff
changeset
|
471 if(command.instruction & ~ command.examined) { |
76 | 472 fprintf(MSG_OUT, " libdvdnav: vmcmd.c: [WARNING, unknown bits:"); |
473 fprintf(MSG_OUT, " %08llx", (command.instruction & ~ command.examined) ); | |
474 fprintf(MSG_OUT, "]"); | |
0 | 475 } |
476 } | |
477 | |
11
1f479a99339c
Change the bits function so that there are no global variables left.
jcdutton
parents:
10
diff
changeset
|
478 void vmPrint_CMD(int row, vm_cmd_t *vm_command) { |
0 | 479 int i; |
480 | |
76 | 481 fprintf(MSG_OUT, "(%03d) ", row + 1); |
0 | 482 for(i = 0; i < 8; i++) |
76 | 483 fprintf(MSG_OUT, "%02x ", vm_command->bytes[i]); |
484 fprintf(MSG_OUT, "| "); | |
0 | 485 |
11
1f479a99339c
Change the bits function so that there are no global variables left.
jcdutton
parents:
10
diff
changeset
|
486 vmPrint_mnemonic(vm_command); |
76 | 487 fprintf(MSG_OUT, "\n"); |
0 | 488 } |
10
6f0fb88d1463
Added some debug info, to hopefully help in tracking bugs in libdvdnav.
jcdutton
parents:
0
diff
changeset
|
489 |
114 | 490 #endif |