📄 big.psm
字号:
LOAD s0C,98 ; write data value
CALL I2C_wr_rd ; write and then verify with read
LOAD s0B,26 ; sub address
LOAD s0C,AD ; write data value
CALL I2C_wr_rd ; write and then verify with read
;-----------------------------------------------------------------------
;
; NTSC encoder values overlayed with PAL changes
;
LOAD s0A,s11 ; device address
LOAD s0B,0C ; sub address
LOAD s0C,CB ; write data value
CALL I2C_wr_rd ; write and then verify with read
LOAD s0B,0D ; sub address
LOAD s0C,8A ; write data value
CALL I2C_wr_rd ; write and then verify with read
LOAD s0B,0E ; sub address
LOAD s0C,09 ; write data value
CALL I2C_wr_rd ; write and then verify with read
LOAD s0B,0F ; sub address
LOAD s0C,2A ; write data value
CALL I2C_wr_rd ; write and then verify with read
AND s06,01 ; bit 0 is SVIDEO_EN
JUMP Z,COMPOSITE
JUMP SVIDEO
;-----------------------------------------------------------------------
;
; SVIDEO selected
;
SVIDEO: LOAD s06,s07 ; restore s06 from test
LOAD s0A,s10 ; device address
LOAD s0B,00 ; sub address
LOAD s0C,17 ; write data value
CALL I2C_wr_rd ; write and then verify with read
AND s06,08 ; bit 3 is COLOR_BAR_EN
JUMP Z,COLOR_BAR_NO
JUMP COLOR_BAR_YES
;-----------------------------------------------------------------------
;
; COMPOSITE selected
;
COMPOSITE: LOAD s06,s07 ; restore s06 from test
LOAD s0A,s10 ; device address
LOAD s0B,00 ; sub address
LOAD s0C,10 ; write data value
CALL I2C_wr_rd ; write and then verify with read
AND s06,08 ; bit 3 is COLOR_BAR_EN
JUMP Z,COLOR_BAR_NO
JUMP COLOR_BAR_YES
;-----------------------------------------------------------------------
;
; COLOR BARS selected
;
COLOR_BAR_YES: LOAD s06,s07 ; restore s06 from test
LOAD s0A,s11 ; device address
LOAD s0B,04 ; sub address
LOAD s0C,40 ; write data value
CALL I2C_wr_rd ; write and then verify with read
AND s06,04 ; bit 2 is GAMMA_EN
JUMP Z, GAMMA_NO ;
LOAD s06,s07 ; restore s06 from test
AND s06,02 ; bit 1 is GAMMA_A
JUMP Z, GAMMA_A
JUMP GAMMA_B
;-----------------------------------------------------------------------
;
; COLOR BARS OFF
;
COLOR_BAR_NO: LOAD s06,s07 ; restore s06 from test
LOAD s0A,s11 ; device address
LOAD s0B,04 ; sub address
LOAD s0C,00 ; write data value
CALL I2C_wr_rd ; write and then verify with read
AND s06,04 ; bit 3 is GAMMA_EN
JUMP Z, GAMMA_NO ;
LOAD s06,s07 ; restore s06 from test
AND s06,02 ; bit 1 is GAMMA_A
JUMP Z, GAMMA_A
JUMP GAMMA_B
;-----------------------------------------------------------------------
;
; NO GAMMA CORRECTION
;
GAMMA_NO: LOAD s06,s07 ; restore s06 from test
LOAD s0A,s11 ; device address
LOAD s0B,08 ; sub address
LOAD s0C,10 ; write data value
CALL I2C_wr_rd ; write and then verify with read
JUMP switch_changes_done
;-----------------------------------------------------------------------
;
; SELECT GAMMA TABLE A
;
GAMMA_A: LOAD s06,s07 ; restore s06 from test
LOAD s0A,s11 ; device address
LOAD s0B,08 ; sub address
LOAD s0C,50 ; write data value
CALL I2C_wr_rd ; write and then verify with read
JUMP switch_changes_done
;-----------------------------------------------------------------------
;
; SELECT GAMMA TABLE B
;
GAMMA_B: LOAD s06,s07 ; restore s06 from test
LOAD s0A,s11 ; device address
LOAD s0B,08 ; sub address
LOAD s0C,D0 ; write data value
CALL I2C_wr_rd ; write and then verify with read
JUMP switch_changes_done
CALL wait_for_change
CALL wait_for_stable
switch_changes_done: RETURN
; //////////////////////////////
; // //
; // Switch Handling Routines //
; // //
; //////////////////////////////
;-----------------------------------------------------------------------
;
; wait_for_change
;
; Compare previous switch values (stored in s07) to see if there
; are any changes. Switches must have changed before going on.
;
wait_for_change: CALL read_switches ;
XOR s06,s07 ; test s06 vs. s07
JUMP NZ,sw_changed ;
XOR s06,s07 ; restores s06
JUMP wait_for_change ;
sw_changed: XOR s06,s07 ; restores s06
RETURN ; s06 and s07 have switches
;-----------------------------------------------------------------------
;
; wait_for_stable
;
; Compare previous switch values (stored in s07) to see if there
; are any changes. Switches must be stable before going on.
;
wait_for_stable: CALL read_switches ;
LOAD s07,s06 ; s0ave s06 in s07
LOAD s08,0F ; loop count
read_sw_loop: CALL read_switches ; read switches
XOR s06,s07 ; test s06 vs. s07
JUMP Z,stable_pass ;
XOR s06,s07 ; restore s06
LOAD s08,00 ; reset loop count
JUMP read_sw_loop ;
stable_pass: XOR s06,s07 ; restore s06
SUB s08,01 ; add one to loop count
JUMP Z,switches_stable; done ?
CALL dly_100ms ;
JUMP read_sw_loop ; read switches again
switches_stable: RETURN ; s06 and s07 have switches
; ///////////////////////////////
; // //
; // I2C Debugger Push Buttons //
; // //
; ///////////////////////////////
;-----------------------------------------------------------------------
;
; I2C Debugger from switches... Enter address by setting the yellow
; buttons to 01, setting the blue buttons to an 8 bit address and
; punching the red "enter button". A s0imilar procedure enters the sub
; address. Set the yellow buttons to 10, then set the blue buttons to
; an 8 bit address and select the red "enter button". Finally, the data
; value to be sent to the address and sub address can be entered. Set
; the yellow buttons to 10, then set the blue buttons to an 8 bit address
; and select the red "enter button".
;
I2C_debugger: CALL chipscope_off ; turn off until new input
INPUT s00,yellow_pb ;
AND s00,03 ; zero msbs
XOR s00,00 ; 00 means proceed
JUMP Z,I2C_debug_w2 ;
JUMP Z,I2C_debugger ; repeat input
I2C_debug_w2: INPUT s0A,blue_pb ; I2C address in s0A
I2C_debug_w3: INPUT s00,yellow_pb ;
AND s00,03 ; zero msbs
XOR s00,01 ; 01 means proceed
JUMP Z,I2C_debug_w4 ;
XOR s00,01 ; restore s00
XOR s00,03 ; 03 means abort
JUMP Z,I2C_debugger ; abort and start over
JUMP I2C_debug_w3 ; repeat input
I2C_debug_w4: INPUT s0B,blue_pb ; I2C sub address in s0B
I2C_debug_w5: INPUT s00,yellow_pb ;
AND s00,03 ; zero msbs
XOR s00,02 ; 02 means proceed
JUMP Z,I2C_debug_w6 ;
XOR s00,02 ; restore s00
XOR s00,03 ; 03 means abort
JUMP Z,I2C_debugger ; abort and start over
JUMP I2C_debug_w5 ; repeat input
I2C_debug_w6: INPUT s0C,blue_pb ; I2C data in s0C
CALL chipscope_on ; turn on, new input
CALL I2C_wr_rd ; write and then verify with read
CALL chipscope_off ; turn off until new input
I2C_debug_w7: INPUT s00,yellow_pb ;
AND s00,03 ; zero msbs
XOR s00,03 ; loop if not three
JUMP NZ,I2C_debug_w7 ;
RETURN ; 03 means start again
; /////////////////////////////////
; // //
; // Routine used to get encoder //
; // out of s0leep mode //
; // //
; /////////////////////////////////
;-----------------------------------------------------------------------
;
; Timing Register 0 needs msb pulsed from low to high to low to reset
; the internal timing counters
;
; encoder_wake_up: LOAD s0A,s11 ; device address
; LOAD s0B,0A ; sub address
; LOAD s0C,09 ; write data value
; CALL I2C_wr_rd ; write and then verify with read
;
; LOAD s0A,s11 ; device address
; LOAD s0B,0A ; sub address
; LOAD s0C,89 ; write data value
; CALL I2C_wr_rd ; write and then verify with read
;
; LOAD s0A,s11 ; device address
; LOAD s0B,0A ; sub address
; LOAD s0C,09 ; write data value
; CALL I2C_wr_rd ; write and then verify with read
;
; RETURN
;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -