                device pic16c71,hs_osc,wdt_off,pwrt_off,protect_off
                id 'sr01'
        include 'mheader.src'

RA3         =   ra.3
RB5         =   rb.5
            
            org     0h
            jmp     5
            org 4h            
doint       jmp     rcv
            org 5h
            clr     PCLATH
            clrb    rp0
            mov     ADCON0, #10000001b
            mov	    INTCON, #00100000b	;RTCC, INT IRQ enabled
            call    dally
            setb    rp0
            mov     TRISA, #0011b
            mov     TRISB, #00000001b
            mov     OPTION, #00000100b  ;RTCC=inst,RB pull-up, /4   
            mov     ADCON1, #00000010b
            clrb    rp0
            mov     RTCC, #fullframe
            setb    waitb
            clrb    inmsg
            clr     ra
            clr     rb
            setb    TXSWTCH
            clrb    PTX
            clr     FSR
            setb    GIE
main        nop
            jmp     main
rcv         mov     RTCC, #fullframe
            setb    RA3
           call    msg_demod
           clrb     RA3
;           jb      waitb, mloop
;            jb      inmsg, msg_demod
intend      clrb    RTIF
            reti



;                    INCLUDE 'ookdmod2.src'
                    INCLUDE 'ookdmod.src'
                    INCLUDE 'collect.src'
                    INCLUDE 'adjgain.src'

dally		mov	tempa,#255
:l1		mov	tempb,#255
:l2		djnz	tempb,:l2
		djnz	tempa,:l1
		ret
                    
                    