📄 osdtune.src
字号:
;
; char pitchCalibration(bit flag)
RSEG ?PR?pitchCalibration?OSDTUNE
USING 0
pitchCalibration:
; SOURCE LINE # 377
; {
; SOURCE LINE # 378
;
; unsigned int pitch,tpitch0;
; bit up = 0,dn = 0;
; SOURCE LINE # 381
CLR up?348
CLR dn?349
;
; #if (DEBUGMSG>=2)
; printf("\n ### Pitch Calib\n");
; #endif
;
; if ( !CalibSuccess )
; SOURCE LINE # 387
JB CalibSuccess,?C0037
; return NOCHANGE;
; SOURCE LINE # 388
MOV R7,#00H
RET
?C0037:
;
; adjust_limit = (unsigned char)(CurrentWidth >> 4);
; SOURCE LINE # 390
MOV A,CurrentWidth+01H
MOV R6,CurrentWidth
MOV R0,#04H
?C0173:
XCH A,R6
MOV C,ACC.7
RRC A
XCH A,R6
RRC A
DJNZ R0,?C0173
MOV R0,#buff+0CH
MOV @R0,A
;
; #if MRT_VITESSE2
; pitch = (flag == EEP_DATA) ? eepModeData.setData.pitch : DefaultPitch;
; SOURCE LINE # 393
JNB flag?345,?C0039
MOV R0,#eepModeData+04H
MOV A,@R0
MOV R6,A
INC R0
MOV A,@R0
MOV R7,A
SJMP ?C0040
?C0039:
MOV R6,DefaultPitch
MOV R7,DefaultPitch+01H
?C0040:
MOV pitch?346,R6
MOV pitch?346+01H,R7
; tpitch0 = pitch;
; SOURCE LINE # 394
MOV tpitch0?347,pitch?346
MOV tpitch0?347+01H,pitch?346+01H
; #endif
;
;
; #if DO_COMPSYNC
; if(RegByteIn(0x07)& 0x01)
; SOURCE LINE # 399
MOV R7,#07H
LCALL _RegByteIn
MOV A,R7
JNB ACC.0,?C0041
; RegByteOut(0xB2, 0x80); // Set color compare mask 0x80
; SOURCE LINE # 400
MOV R7,#0B2H
MOV R5,#080H
LCALL _RegByteOut
SJMP ?C0042
?C0041:
; else
; {
; SOURCE LINE # 402
; #if 0 //(MASCOT_VZ+MASCOT_VXZ+MASCOT_VP2)
; RegByteOut(0xB1, 0x80); // use threshold
; RegByteOut(0xB9, 0x30); // threshold value
; #else
; RegByteOut(0xB1, 0x00);
; SOURCE LINE # 407
MOV R7,#0B1H
CLR A
MOV R5,A
LCALL _RegByteOut
; #endif
; RegByteOut(0xB2,COLORCMPMASK); // Set color compare mask 0xc0
; SOURCE LINE # 409
MOV R7,#0B2H
MOV R5,#0C0H
LCALL _RegByteOut
; }
; SOURCE LINE # 410
?C0042:
; #else
; #if 0 //(MASCOT_VZ+MASCOT_VXZ+MASCOT_VP2)
; RegByteOut(0xB1, 0x80); // use threshold
; RegByteOut(0xB9, 0x30); // threshold value
; #else
; RegByteOut(0xB1, 0x00);
; #endif
; RegByteOut(0xB2,COLORCMPMASK); // Set color compare mask 0xc0
; #endif
;
; RegByteOut(0xB0, 0x04); // Enable vertical calibration
; SOURCE LINE # 421
MOV R7,#0B0H
MOV R5,#04H
LCALL _RegByteOut
;
; miscSetADCPitch(pitch);
; SOURCE LINE # 423
MOV R7,pitch?346+01H
MOV R6,pitch?346
LCALL _miscSetADCPitch
;
; pitchcal0:
; SOURCE LINE # 425
?pitchCalibration?pitchcal0:
;
; if (adjust_limit-- == 0)
; SOURCE LINE # 427
MOV R0,#buff+0CH
MOV A,@R0
DEC @R0
JNZ $ + 5H
LJMP ?pitchCalibration?pitchcal_fail
; {
; SOURCE LINE # 428
; #if DEBUGMSG
; printf(" ERROR: over limit\n");
; #endif
; goto pitchcal_fail;
; SOURCE LINE # 432
; }
; SOURCE LINE # 433
?C0044:
;
; miscSetADCPitch(pitch);
; SOURCE LINE # 435
MOV R7,pitch?346+01H
MOV R6,pitch?346
LCALL _miscSetADCPitch
;
; pitchcal1:
; SOURCE LINE # 437
?pitchCalibration?pitchcal1:
; checkPowerOffButton(); //in pitchCalib
; SOURCE LINE # 438
LCALL checkPowerOffButton
;
; if (!(eepData.MascotFlag & FLAG_POWERSTATUS)) goto pitchcal_fail;
; SOURCE LINE # 440
MOV R0,#eepData+01BH
MOV A,@R0
JB ACC.0,$ + 6H
LJMP ?pitchCalibration?pitchcal_fail
?C0047:
;
;
; RegByteOut(0xB0, 0x02); // Enable vertical calibration
; SOURCE LINE # 443
MOV R7,#0B0H
MOV R5,#02H
LCALL _RegByteOut
; RegByteOut(0x00, 0x00); // Clear the calibration status reg
; SOURCE LINE # 444
CLR A
MOV R7,A
MOV R5,A
LCALL _RegByteOut
;
; if (!waitCalibReady(0x02)) goto pitchcal_fail;
; SOURCE LINE # 446
MOV R7,#02H
LCALL _waitCalibReady
MOV A,R7
JNZ $ + 5H
LJMP ?pitchCalibration?pitchcal_fail
?C0048:
;
; RegByteOut(0xB0, 0x04);
; SOURCE LINE # 448
MOV R7,#0B0H
MOV R5,#04H
LCALL _RegByteOut
; RegByteOut(0x00, 0x00); // Clear the calibration status reg
; SOURCE LINE # 449
CLR A
MOV R7,A
MOV R5,A
LCALL _RegByteOut
;
; if (!waitCalibReady(0x04)) goto pitchcal_fail;
; SOURCE LINE # 451
MOV R7,#04H
LCALL _waitCalibReady
MOV A,R7
JNZ $ + 5H
LJMP ?pitchCalibration?pitchcal_fail
?C0049:
;
; RegDataIn(0xD3, buff, 5);
; SOURCE LINE # 453
MOV R7,#0D3H
MOV R3,#00H
MOV R2,#HIGH (buff)
MOV R1,#LOW (buff)
MOV ?_RegDataIn?BYTE+04H,#00H
MOV ?_RegDataIn?BYTE+05H,#05H
LCALL _RegDataIn
; RegDataIn(0xF9, buff+5, 5);
; SOURCE LINE # 454
MOV R7,#0F9H
MOV R3,#00H
MOV R2,#HIGH (buff+05H)
MOV R1,#LOW (buff+05H)
MOV ?_RegDataIn?BYTE+04H,#00H
MOV ?_RegDataIn?BYTE+05H,#05H
LCALL _RegDataIn
; hStart = ((unsigned int)(buff[2]&0x07)<<8) + buff[0];
; SOURCE LINE # 455
MOV R0,#buff+02H
MOV A,@R0
ANL A,#07H
MOV R6,A
MOV R0,#buff
MOV A,@R0
MOV R4,#00H
ADD A,#00H
MOV R7,A
MOV A,R4
ADDC A,R6
MOV R6,A
MOV R0,#ival1
MOV @R0,A
MOV R4,A
INC R0
MOV A,R7
MOV @R0,A
MOV R5,A
; hWidth = ((unsigned int)(buff[7]&0x70)<<4) + buff[6] - hStart + 1;
; SOURCE LINE # 456
MOV R0,#buff+07H
MOV A,@R0
ANL A,#070H
MOV B,#010H
MUL AB
MOV R7,A
DEC R0
MOV A,@R0
MOV R2,#00H
ADD A,R7
MOV R7,A
MOV A,R2
ADDC A,B
MOV R6,A
CLR C
MOV A,R7
SUBB A,R5
MOV R5,A
MOV A,R6
SUBB A,R4
XCH A,R5
ADD A,#01H
MOV R0,#ival2+01H
MOV @R0,A
CLR A
ADDC A,R5
DEC R0
MOV @R0,A
; #if 1
; #if (DEBUGMSG>=3)
; printf(" hStart = %d , hWidth = %d \n",hStart,hWidth);
; #endif
; #else
; #if (DEBUGMSG>=3)
; printf(" (%04X %04X)-(%04X %04X)",
; ((unsigned int)(buff[2]&0x07)<<8)+buff[0],
; ((unsigned int)(buff[4]&0x07)<<8)+buff[3],
; ((unsigned int)(buff[2]&0x70)<<4)+buff[1],
; ((unsigned int)(buff[4]&0x07)<<8)+buff[3]);
; printf(" (%04X %04X)-(%04X %04X)\n",
; ((unsigned int)(buff[7]&0x07)<<8)+buff[5],
; ((unsigned int)(buff[9]&0x07)<<8)+buff[8],
; ((unsigned int)(buff[7]&0x70)<<4)+buff[6],
; ((unsigned int)(buff[9]&0x07)<<8)+buff[8]);
;
; printf(" hS=%04X hW=%d\n", hStart, hWidth);
; #endif
; #endif
;
;
; ival = ((unsigned int)(buff[7]&0x70)<<4) + buff[6];
; SOURCE LINE # 479
MOV R0,#ival
MOV A,R6
MOV @R0,A
INC R0
MOV A,R7
MOV @R0,A
;
; if ((ival >= hTotal) && (hWidth <= CurrentWidth))
; SOURCE LINE # 481
CLR C
SUBB A,hTotal+01H
MOV A,R6
SUBB A,hTotal
JC ?C0050
SETB C
MOV R0,#ival2+01H
MOV A,@R0
SUBB A,CurrentWidth+01H
DEC R0
MOV A,@R0
SUBB A,CurrentWidth
JNC ?C0050
; {
; SOURCE LINE # 482
; #if (DEBUGMSG>=3)
; printf(" (hStart+hWidth-1) = hRE = %d , hTotal = %d \n",ival,hTotal);
; #endif
; pitch += 8;
; SOURCE LINE # 486
MOV A,#08H
ADD A,pitch?346+01H
MOV pitch?346+01H,A
CLR A
ADDC A,pitch?346
MOV pitch?346,A
; miscSetADCPitch(pitch);
; SOURCE LINE # 487
MOV R7,pitch?346+01H
MOV R6,A
LCALL _miscSetADCPitch
; initCalibration();
; SOURCE LINE # 488
LCALL initCalibration
; goto pitchcal1;
; SOURCE LINE # 489
LJMP ?pitchCalibration?pitchcal1
; }
; SOURCE LINE # 490
?C0050:
;
;
; if (hWidth == CurrentWidth)
; SOURCE LINE # 493
MOV R0,#ival2
MOV A,@R0
MOV R6,A
INC R0
MOV A,@R0
MOV R7,A
XRL A,CurrentWidth+01H
JNZ ?C0174
MOV A,CurrentWidth
XRL A,R6
?C0174:
JZ ?pitchCalibration?pitchcal_done
; goto pitchcal_done;
; SOURCE LINE # 494
?C0051:
;
; if (hWidth > CurrentWidth)
; SOURCE LINE # 496
SETB C
MOV A,R7
SUBB A,CurrentWidth+01H
MOV A,R6
SUBB A,CurrentWidth
JNC ?pitchCalibration?pitchcal_down
; goto pitchcal_down;
; SOURCE LINE # 497
?C0053:
;
; // pitch up
; if (dn)
; SOURCE LINE # 500
JB dn?349,?pitchCalibration?pitchcal_done
; {
; SOURCE LINE # 501
; #if DEBUGMSG
; printf(" pitch up-----ERROR: back loop, abort pitchCal!\n");
; #endif
; goto pitchcal_done;
; SOURCE LINE # 505
; }
; SOURCE LINE # 506
?C0055:
; up = 1; dn = 0;
; SOURCE LINE # 507
SETB up?348
CLR dn?349
;
; pitch += 1;
; SOURCE LINE # 509
INC pitch?346+01H
MOV A,pitch?346+01H
JNZ ?C0175
INC pitch?346
?C0175:
;
; if (tpitch0 == pitch)
; SOURCE LINE # 511
MOV A,tpitch0?347+01H
XRL A,pitch?346+01H
JNZ ?C0176
MOV A,tpitch0?347
XRL A,pitch?346
?C0176:
JZ $ + 5H
LJMP ?pitchCalibration?pitchcal0
; goto pitchcal_done; // stop if back to old value
; SOURCE LINE # 512
SJMP ?pitchCalibration?pitchcal_done
;
; goto pitchcal0;
; SOURCE LINE # 514
;
; pitchcal_down:
; SOURCE LINE # 516
?pitchCalibration?pitchcal_down:
; if (up)
; SOURCE LINE # 517
JB up?348,?pitchCalibration?pitchcal_done
; {
; SOURCE LINE # 518
; #if DEBUGMSG
; printf(" pitch dn-----ERROR: back loop, abort pitchCal!\n");
; #endif
;
; goto pitchcal_done;
; SOURCE LINE # 523
; }
; SOURCE LINE # 524
?C0057:
; up = 0; dn = 1;
; SOURCE LINE # 525
CLR up?348
SETB dn?349
;
; pitch -= 1;
; SOURCE LINE # 527
MOV A,pitch?346+01H
DEC pitch?346+01H
JNZ ?C0177
DEC pitch?346
?C0177:
;
; if (tpitch0 != pitch) // stop if back to old value
; SOURCE LINE # 529
MOV A,tpitch0?347+01H
XRL A,pitch?346+01H
JNZ ?C0178
MOV A,tpitch0?347
XRL A,pitch?346
?C0178:
JZ $ + 5H
LJMP ?pitchCalibration?pitchcal0
; goto pitchcal0;
; SOURCE LINE # 530
;
; pitchcal_done:
; SOURCE LINE # 532
?pitchCalibration?pitchcal_done:
; eepModeData.setData.pitch = pitch;
; SOURCE LINE # 533
MOV R0,#eepModeData+04H
MOV @R0,pitch?346
INC R0
MOV @R0,pitch?346+01H
; #if USE_PITCH_PATCH
; pitchPatch();
; SOURCE LINE # 535
LCALL pitchPatch
; #endif
; goto pitchcal_ret;
; SOURCE LINE # 537
SJMP ?pitchCalibration?pitchcal_ret
;
; pitchcal_fail:
; SOURCE LINE # 539
?pitchCalibration?pitchcal_fail:
; CalibSuccess = 0;
; SOURCE LINE # 540
CLR CalibSuccess
; eepModeData.setData.pitch = DefaultPitch;
; SOURCE LINE # 541
MOV R0,#eepModeData+04H
MOV @R0,DefaultPitch
INC R0
MOV @R0,DefaultPitch+01H
;
; pitchcal_ret:
; SOURCE LINE # 543
?pitchCalibration?pitchcal_ret:
; eepModeData.setData.pitch_val = DEF_pitchval;
; SOURCE LINE # 544
MOV R0,#eepModeData+07H
MOV @R0,#032H
; eepModeData.setData.def_pitch = eepModeData.setData.pitch;
; SOURCE LINE # 545
MOV R0,#eepModeData+04H
MOV A,@R0
MOV R7,A
INC R0
MOV A,@R0
MOV R0,#eepModeData+0BH
XCH A,R7
MOV @R0,A
INC R0
MOV A,R7
MOV @R0,A
; RegByteOut(0xB0, 0x00); // Disable calibration
; SOURCE LINE # 546
MOV R7,#0B0H
CLR A
MOV R5,A
LCALL _RegByteOut
;
; miscSetADCPitch(eepModeData.setData.pitch);
; SOURCE LINE # 548
MOV R0,#eepModeData+04H
MOV A,@R0
MOV R6,A
INC R0
MOV A,@R0
MOV R7,A
LCALL _miscSetADCPitch
;
; if (tpitch0 == eepModeData.setData.pitch)
; SOURCE LINE # 550
MOV A,tpitch0?347+01H
MOV R0,#eepModeData+05H
XRL A,@R0
JNZ ?C0179
MOV A,tpitch0?347
DEC R0
XRL A,@R0
?C0179:
JNZ ?C0060
; return NOCHANGE;
; SOURCE LINE # 551
MOV R7,A
RET
?C0060:
;
; return CHANGE;
; SOURCE LINE # 553
MOV R7,#01H
;
; }
; SOURCE LINE # 555
?C0038:
RET
; END OF pitchCalibration
;
;
;
; #undef hStart
; #undef hWidth
;
; #undef adjust_limit
;
;
; /************************************************
; * Phase Calibration use hWidth *
; *************************************************/
; #define hStart ival
; #define hWidth ival1
; #define minhWidth ival2
;
;
; #define phaseStart buff[12]
; #define phaseEnd buff[13]
; #define phaseStart1 buff[14]
; #define phaseEnd1 buff[15]
; #define phaseStart2 buff[16]
; #define phaseEnd2 buff[17]
;
;
; void phaseHWCalibration(void)
RSEG ?PR?phaseHWCalibration?OSDTUNE
USING 0
phaseHWCalibration:
; SOURCE LINE # 581
; {
; SOURCE LINE # 582
;
; bit phaseOkFlag=0;
; SOURCE LINE # 584
CLR phaseOkFlag?450
; bit phaseOkFlag1=0;
; SOURCE LINE # 585
CLR phaseOkFlag1?451
; bit phaseOkFlag2=0;
; SOURCE LINE # 586
CLR phaseOkFlag2?452
; unsigned char phase;
;
; if ( !CalibSuccess ) return;
; SOURCE LINE # 589
JB CalibSuccess,$ + 6H
LJMP ?C0062
?C0061:
;
;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -