📄 measure.lst
字号:
252 1
253 1 VPositionRange.Min = PCMDATA[PcMode].Vstart * 2 - VPosMax; // Rang : from (vstart - front) to (hvstar
-t + front)
254 1 VPositionRange.Max = VPosMax;
255 1 VPositionRange.Default = PCMDATA[PcMode].Vstart ;
256 1
257 1 Mapping2( VPosCurr, &VPositionRange, &newv, &UserRange );
258 1
259 1 return newv;
260 1 }
261
262 BYTE SetVPosition(BYTE val) //0:UP, 1:DOWN
263 {
264 1 int newv;
265 1 struct RegisterInfo VPositionRange;
266 1 char add;
267 1
268 1 VPositionRange.Min = PCMDATA[PcMode].Vstart * 2 - VPosMax; // Rang : from (vstart - front) to (vstart
- + front)
269 1 VPositionRange.Max = VPosMax;
270 1 VPositionRange.Default = PCMDATA[PcMode].Vstart ;
271 1
272 1 #ifdef DEBUG
273 1 dPrintf("\r\n vpos min: %d, max: %d, cur: %d", VPositionRange.Min, VPositionRange.Max, (WORD)VPosCurr);
274 1 #endif
275 1
276 1 add = ( val==UP ? 1 : -1 );
277 1 if( (VPosCurr + add) < VPositionRange.Min || (VPosCurr + add) > VPositionRange.Max )
278 1 {
279 2 Mapping2( VPosCurr, &VPositionRange, &newv, &UserRange );
280 2 return newv;
281 2 }
282 1
283 1 VPosCurr += add;
284 1 Mapping2( VPosCurr, &VPositionRange, &newv, &UserRange );
285 1
286 1 if( IsBypassmode() ) {
287 2 SetVactiveStart( VPosCurr );
288 2 SaveVactiveEE(PcMode); // HHY 1.33
289 2 }
290 1 else {
291 2 SetVactiveStart( VPosCurr );
292 2 SaveVactiveEE(PcMode); // HHY 1.33
293 2 SetVBackPorch( GetVBackPorch()+add ); // A6
294 2 SaveVBackPorchEE(PcMode); // HHY 1.33
295 2 }
296 1
297 1 return newv;
298 1 }
299
300 BYTE GetHPosition(void)
C51 COMPILER V7.50 MEASURE 04/01/2008 15:02:17 PAGE 6
301 {
302 1 int newv;
303 1 struct RegisterInfo HPositionRange;
304 1
305 1 HPositionRange.Min = PCMDATA[PcMode].Hstart * 2 - HPosMax; // Rang : from (Hstart - front) to (hstart
- + front)
306 1 HPositionRange.Max = HPosMax;
307 1 HPositionRange.Default = PCMDATA[PcMode].Hstart ;
308 1
309 1 Mapping2( HPosCurr, &HPositionRange, &newv, &UserRange );
310 1
311 1 return newv;
312 1 }
313
314 BYTE SetHPosition(BYTE val)
315 {
316 1 int newv;
317 1
318 1 char add;
319 1 WORD hend;
320 1 struct RegisterInfo HPositionRange;
321 1
322 1 HPositionRange.Min = PCMDATA[PcMode].Hstart * 2 - HPosMax; // Rang : from (Hstart - front) to (hstart
- + front)
323 1 HPositionRange.Max = HPosMax;
324 1 HPositionRange.Default = PCMDATA[PcMode].Hstart ;
325 1
326 1 #ifdef DEBUG
327 1 dPrintf("\r\n hpos min: %d, max: %d, cur: %d", HPositionRange.Min, HPositionRange.Max, (WORD)HPosCurr);
328 1 #endif
329 1
330 1 add = ( val==UP ? 1 : -1 );
331 1 if( (HPosCurr + add) < HPositionRange.Min || (HPosCurr + add) > HPositionRange.Max )
332 1 {
333 2 Mapping2( HPosCurr, &HPositionRange, &newv, &UserRange );
334 2 return newv;
335 2 }
336 1
337 1 HPosCurr += add;
338 1 Mapping2( HPosCurr, &HPositionRange, &newv, &UserRange );
339 1
340 1 hend = GetHactiveEnd();
341 1
342 1 hend += add;
343 1 SetHactiveStart(HPosCurr);
344 1 SetHactiveEnd(hend);
345 1
346 1 SaveHactiveEE(PcMode); // HHY 1.33
347 1
348 1 return newv;
349 1 }
350 //=============================================================================
351 // Phase Measurement
352 // Return : PhaseBlue, PhaseGreen, PhaseRed
353 //=============================================================================
354 DWORD ReadOut4(void)
355 {
356 1 BYTE i;
357 1 DWORD dat=0;
358 1
359 1 for(i=0; i<4; i++) {
360 2 dat <<= 8;
C51 COMPILER V7.50 MEASURE 04/01/2008 15:02:17 PAGE 7
361 2 dat |= (DWORD)ReadTW88(0x5a-i);
362 2 }
363 1 return dat;
364 1 }
365
366 BYTE GetPhaseRGB(void) // HHY 1.10 BYTE return
367 {
368 1 static bit flag=0;
369 1 DWORD _RGB;
370 1
371 1 #ifdef DEBUG_PC
372 1 BYTE sign;
373 1 #endif
374 1
375 1 _RGB = PhaseRGB;
376 1
377 1 if( !MeasureAndWait(3) ) {
378 2 #ifdef DEBUG_PC
379 2 dPuts("\r\n Error at GetPhaseRGB");
380 2 #endif
381 2 return 0; //LJY001219
382 2 }
383 1
384 1 WriteTW88(0x5b, 0x00); // Read Phase B
385 1 PhaseRGB = ReadOut4();
386 1
387 1 WriteTW88(0x5b, 0x10); // Read Phase G
388 1 PhaseRGB += ReadOut4();
389 1
390 1 WriteTW88(0x5b, 0x20); // Read Phase R
391 1 PhaseRGB += ReadOut4();
392 1
393 1 #ifdef DEBUG_PC
394 1 if( PhaseRGB >= _RGB ) sign = '+'; else sign = '-';
395 1 dPrintf("(%c%08lx)", (WORD)sign, PhaseRGB);
396 1 #endif
397 1
398 1 if( PhaseRGB==_RGB ) { // NO INPUT ???
399 2 dPuts("\r\n??? SYNC loss...");
400 2 if(flag) {
401 3 flag = 0;
402 3 return 0;
403 3 }
404 2 else flag = 1;
405 2 }
406 1 else flag = 0;
407 1
408 1 return 1;
409 1 }
410
411
412 //============================================================================
413 // Determine InputSource Format based on VPN
414 //============================================================================
415 // Input VPN
416 // Return PcMode
417 // InputSource (PC_XGA, PC_SVGA, PC_VGA)
418
419 BYTE DecideVGAInputSource(WORD vpn, WORD ivf)
420 {
421 1 BYTE _PcMode;
422 1
C51 COMPILER V7.50 MEASURE 04/01/2008 15:02:17 PAGE 8
423 1 #ifdef DEBUG_PC
424 1 dPrintf("\r\n-----> DecideVGAInputSource: vpn:%4xh, ivf:%4xh", vpn, ivf);
425 1 #endif
426 1
427 1
428 1 _PcMode = EE_PC_UNKNOWN;
429 1
430 1 //====================== PC DOS ================================
431 1 if( vpn >= 440 && vpn <= 460 ) {
432 2 #ifdef DEBUG_PC
433 2 dPrintf("\r\n========= PC DOS ==================: vpn:%4d, ivf:%4d", (WORD)vpn, (WORD)ivf);
434 2 #endif
435 2 //InputSource = PC_DOS1;
436 2 switch( ivf ) {
437 3 case 69: case 70: case 71: _PcMode = EE_DOS; break;
438 3
439 3 case 84: case 85: case 86: case 87:
440 3 GetHpnVpn(1);
441 3 if( ReadTW88(0x40) & 0x02 )
442 3 _PcMode = EE_SP1;
443 3 else
444 3 _PcMode = EE_SP2;
445 3 break;
446 3
447 3 default: _PcMode = EE_PC_UNKNOWN; break;
448 3
449 3 }
450 2 }
451 1 //====================== PC VGA, DTV 480P ======================
452 1 else if( vpn>=490 && vpn<=540 ) {
453 2
454 2 #ifdef DEBUG_PC
455 2 dPrintf("\r\n============ PC VGA, DTV 480P ============: vpn:%4d, ivf:%4d", (WORD)vpn, (WORD)ivf);
456 2 #endif
457 2 switch( ivf ) {
458 3 case 59: case 60: case 61:
459 3 _PcMode = EE_VGA_60; break;
460 3 case 65: case 66: case 67: _PcMode = EE_VGA_66; break;
461 3 case 69: case 70: case 71: _PcMode = EE_VGA_70; break;
462 3 case 72: case 73: _PcMode = EE_VGA_72; break;
463 3 case 74: case 75: case 76: _PcMode = EE_VGA_75; break;
464 3 case 83:
465 3 case 84: case 85: case 86: _PcMode = EE_VGA_85; break;
466 3 default: _PcMode = EE_PC_UNKNOWN; break;
467 3 }
468 2 }
469 1 //====================== PC SVGA ===============================
470 1 else if( vpn>=610 && vpn<=680+30 ) {
471 2 #ifdef DEBUG_PC
472 2 dPrintf("\r\n=========== PC SVGA ================: vpn:%4d, ivf:%4d", (WORD)vpn, (WORD)ivf);
473 2 #endif
474 2 //InputSource = PC_SVGA;
475 2 switch( ivf ) {
476 3 case 49: case 50: case 51: _PcMode = EE_RGB_576P; break;
477 3
478 3 case 55: case 56: case 57: _PcMode = EE_SVGA_56; break;
479 3 case 59: case 60: case 61: case 62: case 63: case 64:
480 3 _PcMode = EE_SVGA_60; break;
481 3 case 69: case 70: case 71: _PcMode = EE_SVGA_70; break;
482 3 case 72: case 73: _PcMode = EE_SVGA_72; break;
483 3 case 74: case 75: case 76: _PcMode = EE_SVGA_75; break;
484 3
C51 COMPILER V7.50 MEASURE 04/01/2008 15:02:17 PAGE 9
485 3 case 83:
486 3 case 84: case 85: case 86: _PcMode = EE_SVGA_85; break;
487 3
488 3 default: _PcMode = EE_PC_UNKNOWN; break;
489 3 }
490 2 }
491 1
492 1 //====================== DTV 720P ==============================
493 1 else if(vpn>=751-20 && vpn<=751+30) {
494 2 #ifdef DEBUG_PC
495 2 dPrintf("\r\n============== DTV 720P ============: vpn:%4d, ivf:%4d", (WORD)vpn, (WORD)ivf);
496 2 #endif
497 2 if( ivf>=55 ) {
498 3 _PcMode = EE_RGB_720P;
499 3 }
500 2 else {
501 3 _PcMode = EE_RGB_720P50;
502 3 }
503 2 }
504 1 //====================== DTV 1080i =============================
505 1 else if(vpn>=563-10 && vpn<=563+10) {
506 2 #ifdef DEBUG_PC
507 2 dPrintf("\r\n============ DTV 1080i =============: vpn:%4d, ivf:%4d", (WORD)vpn, (WORD)ivf);
508 2 #endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -