Skip to content
Permalink
Browse files

SuperCIC: fix previous fix, increase tolerance, make lock work with e…

…very key
  • Loading branch information...
mrehkopf committed Mar 29, 2019
1 parent d80e61f commit c74abd47ea804f780997dff309e422be76e70a5b
Showing with 12 additions and 10 deletions.
  1. +3 −2 cic/supercic/supercic-key.asm
  2. +9 −8 cic/supercic/supercic-lock.asm
@@ -234,15 +234,14 @@ main
bcf STATUS, RP0
movlw 0x27 ; "wait" 1
call wait ; wait 121
nop
; --------main loop--------
loop
movlw 0x1
loop0
addlw 0x30 ; key stream
movwf FSR ; store in index reg
loop1
nop
nop
nop
movf INDF, w ; load seed value
movwf 0x20
@@ -254,6 +253,8 @@ loop1
movwf GPIO
nop
nop
nop
nop
movlw 0x10
movwf GPIO ; reset GPIO
movlw 0x13
@@ -387,8 +387,10 @@ main
bcf TRISC, 1
bcf STATUS, RP0
nop
movlw 0x23 ;
call wait ; wait 109
movlw 0x22 ;
call wait ; wait 106
nop
nop
movlw 0x1 ; 'first time' bit
movwf 0x43 ; for key detection
; --------main loop--------
@@ -409,6 +411,7 @@ loop1
movf 0x20, w
movwf PORTC
nop
nop
movf PORTC, w ; read input
movwf 0x42 ; store input
movf 0x50, w ; get LED state
@@ -432,7 +435,6 @@ loop1
clrf 0x59 ; clear D4 output
btfsc 0x54, 1 ; use effective region for D4 output
bsf 0x59, 4
nop

main_skipinval2
call checkrst
@@ -480,7 +482,6 @@ swapskip


main_skipinval1
nop
nop
nop
goto main_skipinval2
@@ -654,12 +655,12 @@ mangle_key_withskip
movwf 0x5e
nop
bcf PORTC, 1
nop ; add nop here, 2010 SCIC key is a bit late.
movf PORTC, w
movwf 0x5f
nop
nop
nop
nop
btfss 0x20, 4 ; skip if half-byte carry
goto mangle_return ; +2 cycles in return
movf 0x20, w ; restore w (previously destroyed)
@@ -763,7 +764,7 @@ mangle_lock_withoutskip
goto mangle_lock_loop
; 69 when goto, 69 when return
; CIC has 78 -> 9 nops

mangle_lock_withskip
movf 0x41, w ; restore 33
addwf 0x33, f ; add to 33
@@ -1127,7 +1128,7 @@ rst2_loop2
goto rst ; finally reset
; -----------------------------------------------------------------------
; eeprom data
DEEPROM CODE
org __EEPROM_START
de 0x01 ;current mode (default: 60Hz)
end
end
; ------------------------------------------------------------------------

0 comments on commit c74abd4

Please sign in to comment.
You can’t perform that action at this time.