IGR: several bugfixes, more tolerant decoding (12 vs. 16 bits)
This commit is contained in:
parent
221c165aef
commit
cc786a965e
@ -110,14 +110,23 @@ start
|
||||
bsf 0x24, 1
|
||||
|
||||
clrf 0x23
|
||||
btfss 0x24, 1 ; SuperCIC present?
|
||||
bsf 0x23, 1 ; then enable passthru
|
||||
btfss 0x24, 1 ; SuperCIC absent?
|
||||
goto doregion_60 ; then set defaults
|
||||
|
||||
goto doregion_60 ; set defaults
|
||||
bsf 0x23, 1 ; else enable passthru
|
||||
|
||||
idle
|
||||
; check region passthru
|
||||
btfss 0x23, 1 ; passthru enabled?
|
||||
goto waitforlatch_h ;
|
||||
btfsc PORTA, 3
|
||||
bsf PORTA, 4
|
||||
btfss PORTA, 3
|
||||
bcf PORTA, 4
|
||||
call setleds_passthru
|
||||
waitforlatch_h ; wait for "latch" to become high
|
||||
btfss PORTA, 1
|
||||
goto waitforlatch_h
|
||||
goto idle
|
||||
|
||||
|
||||
waitforlatch_l ; wait for "latch" to become low
|
||||
@ -140,7 +149,7 @@ dl1_wait
|
||||
goto dl1_wait
|
||||
btfss 0x22, 3 ;first byte done?
|
||||
goto dl1
|
||||
bcf STATUS, C ; clear carry
|
||||
clrf 0x22
|
||||
dl2
|
||||
movf PORTA, w ;read data bit
|
||||
rlf 0x21, f ;shift
|
||||
@ -150,53 +159,46 @@ dl2
|
||||
dl2_wait
|
||||
btfss PORTA, 2 ;wait for clk=h
|
||||
goto dl2_wait
|
||||
btfss 0x22, 4
|
||||
btfss 0x22, 2 ; read only 4 bits
|
||||
goto dl2
|
||||
|
||||
; check region passthru
|
||||
btfss 0x23, 1 ; passthru enabled?
|
||||
goto checkkeys ;
|
||||
btfsc PORTA, 3
|
||||
bsf PORTA, 4
|
||||
btfss PORTA, 3
|
||||
bcf PORTA, 4
|
||||
call setleds_passthru
|
||||
|
||||
|
||||
|
||||
checkkeys
|
||||
; we now have the first 8 bits in 0x20 and the second 8 bits in 0x21
|
||||
; we now have the first 8 bits in 0x20 and the second 4 bits in 0x21
|
||||
; 00011111 00011111 = ABXY, Select, L
|
||||
movlw 0x4f
|
||||
movlw 0x04
|
||||
xorwf 0x21, w
|
||||
btfsc STATUS, Z
|
||||
goto group4f
|
||||
movlw 0x8f
|
||||
goto group04
|
||||
movlw 0x08
|
||||
xorwf 0x21, w
|
||||
btfsc STATUS, Z
|
||||
goto group8f
|
||||
movlw 0xcf
|
||||
goto group08
|
||||
movlw 0x0c
|
||||
xorwf 0x21, w
|
||||
btfsc STATUS, Z
|
||||
goto groupcf
|
||||
goto waitforlatch_h
|
||||
goto group0c
|
||||
goto idle
|
||||
|
||||
group4f
|
||||
group04
|
||||
movlw 0xdf
|
||||
xorwf 0x20, w
|
||||
btfss STATUS, Z
|
||||
goto waitforlatch_h
|
||||
goto idle
|
||||
goto doregion_60
|
||||
|
||||
group8f
|
||||
group08
|
||||
movlw 0xdf
|
||||
xorwf 0x20, w
|
||||
btfss STATUS, Z
|
||||
goto waitforlatch_h
|
||||
goto idle
|
||||
btfss 0x24, 1 ; SuperCIC absent?
|
||||
goto doreset_long ; then do long reset
|
||||
goto doreset_dbl ; else do dbl reset
|
||||
|
||||
groupcf
|
||||
group0c
|
||||
movlw 0x5f
|
||||
xorwf 0x20, w
|
||||
btfsc STATUS, Z
|
||||
@ -209,7 +211,7 @@ groupcf
|
||||
xorwf 0x20, w
|
||||
btfsc STATUS, Z
|
||||
goto doreset_normal
|
||||
goto waitforlatch_h
|
||||
goto idle
|
||||
|
||||
doreset_normal
|
||||
banksel TRISA
|
||||
@ -221,7 +223,7 @@ doreset_normal
|
||||
banksel TRISA
|
||||
bsf TRISA, 5
|
||||
banksel PORTA
|
||||
goto waitforlatch_h
|
||||
goto idle
|
||||
|
||||
doreset_dbl
|
||||
banksel TRISA
|
||||
@ -240,7 +242,7 @@ doreset_dbl
|
||||
banksel TRISA
|
||||
bsf TRISA, 5
|
||||
banksel PORTA
|
||||
goto waitforlatch_h
|
||||
goto idle
|
||||
|
||||
doreset_long
|
||||
banksel TRISA
|
||||
@ -252,25 +254,25 @@ doreset_long
|
||||
banksel TRISA
|
||||
bsf TRISA, 5
|
||||
banksel PORTA
|
||||
goto waitforlatch_h
|
||||
goto idle
|
||||
|
||||
doregion_50
|
||||
bsf PORTA, 4
|
||||
clrf 0x23
|
||||
call setleds_own
|
||||
goto waitforlatch_h
|
||||
goto idle
|
||||
|
||||
doregion_60
|
||||
bcf PORTA, 4
|
||||
clrf 0x23
|
||||
call setleds_own
|
||||
goto waitforlatch_h
|
||||
goto idle
|
||||
|
||||
doregion_passthru
|
||||
clrf 0x23
|
||||
btfsc 0x24, 1 ; SuperCIC present?
|
||||
bsf 0x23, 1 ; then enable passthru
|
||||
goto waitforlatch_h
|
||||
goto idle
|
||||
|
||||
; --------wait: 3*(W-1)+7 cycles (including call+return). W=0 -> 256!--------
|
||||
wait
|
||||
|
||||
@ -2,26 +2,27 @@
|
||||
:100000008312031385010730990000308B0083169B
|
||||
:1000100003132F3085000F308700003095008030AB
|
||||
:100020008100831203138516A4010719A414A301E8
|
||||
:10003000A418A314851C1A2885181C28A001A10146
|
||||
:10004000A20103100508A00D0139A004A20A051D94
|
||||
:100050002728A21D222803100508A10D0139A1049B
|
||||
:10006000A20A051D3128221E2C28A31C3C28851914
|
||||
:100070000516851D0512B2204F30210603194928A7
|
||||
:100080008F30210603194E28CF3021060319552839
|
||||
:100090001A28DF302006031D1A289828DF30200692
|
||||
:1000A000031D1A28A41C862870285F302006031917
|
||||
:1000B0009C289F30200603199428CF30200603196E
|
||||
:1000C00062281A28831603138512831203138516D8
|
||||
:1000D0001530A420831603138516831203131A28E0
|
||||
:1000E0008316031385128312031385161530A4207B
|
||||
:1000F0008316031385160301A42085121530A4204E
|
||||
:10010000831603138516831203131A288316031309
|
||||
:1001100085128312031385161E30AA20831603133B
|
||||
:100120008516831203131A280516A301B9201A286D
|
||||
:100130000512A301B9201A28A301A418A3141A2890
|
||||
:10014000AF00AF0BA128A728AE000301A028AE0B7B
|
||||
:10015000A6280800AD000301A420AD0BAC280800C0
|
||||
:10016000A41CB92803010718203887181038870005
|
||||
:1001700008002030051E10308719303A870008002B
|
||||
:10003000A41C9928A314A31C222885190516851D24
|
||||
:100040000512B320851C1B2885182428A001A101B6
|
||||
:10005000A20103100508A00D0139A004A20A051D84
|
||||
:100060002F28A21D2A28A2010508A10D0139A104EB
|
||||
:10007000A20A051D3928221D34280430210603193F
|
||||
:100080004A280830210603194F280C30210603198D
|
||||
:1000900056281B28DF302006031D1B289928DF3037
|
||||
:1000A0002006031D1B28A41C872871285F3020060A
|
||||
:1000B00003199D289F30200603199528CF3020066C
|
||||
:1000C000031963281B288316031385128312031355
|
||||
:1000D00085161530A5208316031385168312031386
|
||||
:1000E0001B288316031385128312031385161530FC
|
||||
:1000F000A5208316031385160301A520851215304C
|
||||
:10010000A520831603138516831203131B28831659
|
||||
:10011000031385128312031385161E30AB2083163A
|
||||
:1001200003138516831203131B280516A301BA2097
|
||||
:100130001B280512A301BA201B28A301A418A3148D
|
||||
:100140001B28AF00AF0BA228A828AE000301A128EE
|
||||
:10015000AE0BA7280800AD000301A520AD0BAD280C
|
||||
:100160000800A41CBA280301071820388718103883
|
||||
:10017000870008002030051E10308719303A8700AC
|
||||
:02018000080075
|
||||
:02400E00D43F9D
|
||||
:00000001FF
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user