/usr/share/doc/libsyntax-highlight-engine-kate-perl/examples/samples/highlight.asm is in libsyntax-highlight-engine-kate-perl 0.10+dfsg-1ubuntu2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 | ;
; Decodeur de trame pulsadis EJP et préavis EJP
; (pic 12C508 ou 509)
; Alain Gibaud, 20-2-2001
;
; ========================================================
list r=hex,p=p12c508
include "p12c508.inc"
GP0 equ 0
GP1 equ 1
GP2 equ 2
GP3 equ 3
GP4 equ 4
GP5 equ 5
TO equ 4
; masques pour acceder aux pattes
GP0bit equ 1 << GP0
GP1bit equ 1 << GP1
GP2bit equ 1 << GP2
GP3bit equ 1 << GP3
GP4bit equ 1 << GP4
GP5bit equ 1 << GP5
; ========================================================
; affectation des pattes
;
; sorties: (actives niv bas)
NORMAL equ GP0 ; LED verte
ALERTE equ GP1 ; LED orange
EJP equ GP2 ; LED rouge
; entrees:( actives niv bas)
SIGNAL equ GP3 ; avec pull-up, en provenance filtre 175 Hz
; GP4-5 sont utilisees par l'horloge
; ========================================================
; variables:
TICKS equ 0x7 ; compteur de ticks (1 tick = 2/100 s)
SLOT equ 0x8 ; numero slot dans la trame
; =======================================================
; Macros pour alleger le code ...
;
; Teste si min <= (var) < max
; branche en "in" si oui, en "out" si non.
;
Lminmax macro var,min,max,outm,in,outp
movlw min
subwf var,W ; (var) - min
btfss STATUS,C
goto outm ; C=0 => resutat < 0 => var < min
movlw max
subwf var,W ; (var) - max
btfss STATUS,C
goto in
goto outp ; C=1 => resutat >= 0 => var >= min
endm
;
; Attend que le bit "bit" du registre "reg" soit a 1
;
Waitbit1 macro reg,bit
local Wait1
Wait1 btfss reg,bit
goto Wait1
endm
;
; Attend que le bit "bit" du registre "reg" soit a 0
;
Waitbit0 macro reg,bit
local Wait0
Wait0 btfsc reg,bit
goto Wait0
endm
;
; Branche en "label" si (reg) == num, sinon continue
;
Beq macro label,reg,num
movlw num
subwf reg,W
btfsc STATUS,Z
goto label
endm
;
; Branche en "label" si (reg) != num, sinon continue
;
Bne macro label,reg,num
movlw num
subwf reg,W
btfss STATUS,Z
goto label
endm
;
; Branche en "label" si (reg) < num, sinon continue
;
Blt macro label,reg,num
movlw num
subwf reg,W ; reg - W
btfss STATUS,C
goto label ; C=0 => reg - W < 0
endm
;
; Branche en "label" si (reg) >= num, sinon continue
;
Bge macro label,reg,num
movlw num
subwf reg,W ; reg - W
btfsc STATUS,C
goto label ; C=1 => reg - W >= 0
endm
; ========================================================
; CONFIG word ( en FFF )
; bits 11:5 don't care
; bit 4 : MCLRE enabled = 1, tied to Vdd = 0
; bit 3 : code protection off = 1, on = 0
; bit 2 : no watchdog = 0, watchdog = 1
; bit 1-0 ; EXTRC = 00, INTRC = 10, XT = 01, LP = 00
__CONFIG B'000000001101' ; (horloge a quartz, avec watchdog)
; ========================================================
org 0
goto debut
;=========================================================
; sous-programmes
; ========================================================
; regarde si le timer est passe a 0
; si oui, le compteur de ticks est incremente
; et on attend le repassage a 1
; Cette routine DOIT etre appelee tout les 2/100 s ou plus souvent
tickcount
clrwdt
movf TMR0,W
btfss STATUS,Z
retlw 0
incf TICKS,F
; attendre que le timer ait depasse 0
waitnoZ
clrwdt
movf TMR0,W
btfsc STATUS,Z
goto waitnoZ
retlw 0
;
; les 2 fct qui suivent maintiennent, le compteur de ticks
; (en plus de scruter une patte)
; attente d'un signal (logique negative)
waitsignal
call tickcount
btfsc GPIO,SIGNAL
goto waitsignal
retlw 0
; attente fin signal
waitnosignal
call tickcount
btfss GPIO,SIGNAL
goto waitnosignal
retlw 0
; remet a zero le compteur de ticks et le timer et le watchdog
clearticks
clrwdt
clrw
movwf TICKS
movwf TMR0
; pour eviter un timeout immediat, le timer est charge
; a 1, et le 1er tick ne fait que 0.019922s au lieu de 0.2s
; (ce n'est pas grave dans la mesure ou de toute facon,
; le temps de traitement entre les different declenchements
; de chrono n'est pas nul)
incf TMR0,F
retlw 0
;
; ==========================================================
;
debut
; reset par Watchdog ?
btfsc STATUS,TO
goto notimeout
; TO == 0 : OUI
clrwdt
goto 0x1FF ; recalibrage, 0x3FF sur 12C509
; TO == 1 : NON
notimeout
movwf OSCCAL ; recalibrer l'horloge
clrf TMR0 ; RAZ timer
; GPWU=1 : disable wake up on pin change
; GPPU=0 : enable pullups (a voir avec le hard ..)
; T0CS=0 : timer connected to F/4
; T0SE=x : dont't care
; PSA=0 : prescaler assigned to timer
; PS2-0= : timer prescaler 111= 1/256, 101 = 1/64, 011 = 1/16
movlw B'10010101'
option
; config des pattes
movlw B'00001000' ; GP0-2 en sortie, GP3 entree
tris GPIO
; se mettre en mode normal
bcf GPIO,NORMAL
bsf GPIO,ALERTE
bsf GPIO,EJP
attendre_trame
call waitnosignal ; attendre ...
call waitsignal ; ... front montant
call clearticks
call waitnosignal
; 45 tk = 0.9s, 55 tk = 1.1s
Lminmax TICKS,D'45',D'55',attendre_trame,pulse1s,attendre_trame
pulse1s
; attendre 162,5 tk = 2.75 s + 0.5 s = 3.25 s
call clearticks
again325
call tickcount
Lminmax TICKS,D'162',D'162',again325,again325,end325
end325
; on est maintenant au centre du 1er bit
; il suffit d'echantillonner toutes les 2.5s
movlw 1
movwf SLOT
sample btfsc GPIO,SIGNAL ; logique negative
goto slot40
; signal detecte !!
Bne not5,SLOT,D'5' ; slot == 5 ?
; oui - 5 = passage en alerte
bsf GPIO,NORMAL ; bit a 1 = LED eteinte
bsf GPIO,EJP ; bit a 1 = LED eteinte
bcf GPIO,ALERTE ; bit a 0 = LED allumee
goto nextslot
not5
Bne not15,SLOT,D'15' ; slot == 15 ?
; oui
btfsc GPIO,ALERTE ; deja en alerte ?
goto endejp
; oui - 5 & 15 = debut ejp
bsf GPIO,NORMAL ; bit a 1 = LED eteinte
bsf GPIO,ALERTE ; bit a 1 = LED eteinte
bcf GPIO,EJP ; bit a 0 = LED allumee
goto nextslot
endejp
; non - 15 seul = fin ejp
bsf GPIO,EJP ; bit a 1 = LED eteinte
bsf GPIO,ALERTE ; bit a 1 = LED eteinte
bcf GPIO,NORMAL ; bit a 0 = LED allumee
goto nextslot
not15
slot40
; slot 40 ?
Bne nextslot,SLOT,D'40' ; slot == 40 ?
; et attendre une nouvelle trame
goto attendre_trame
nextslot
incf SLOT,F
; si le signal est a 1, on en profite pour se resynchroniser
; sur son front descendant, au cas ou l'emetteur ne soit pas
; bien conforme au protocole.
btfss GPIO,SIGNAL
goto resynchro
; attendre 125 ticks = 2.5s
call clearticks
again125
call tickcount
Lminmax TICKS,D'125',D'126',again125,sample,again125
resynchro
call waitnosignal
call clearticks
again100 ; attente 2 s (100 ticks)
call tickcount
Lminmax TICKS,D'100',D'101',again100,sample,again100
end
|