
                IRRC    EQU     P3.2    ;Connected to IR receive module. (INT0)
                CK      EQU     P3.3    ;Connected to PC's MIC-in.

                ORG     0000H
                JMP     Init
                ORG     0003H
                JMP     INT0
                ORG     0050H
Init:           CLR     CK              ;pull down the debug pin
                SETB    IT0             ;Enable INT0
                SETB    EX0
                SETB    EA
ST:             JMP     ST              ;Wait for remote control signal.
;               ---------------------
INT0:           CLR     EX0

        CALL    CKBIT                   ;whenever calling the CKBIT a single pulse will be sent to MIC-in
        CALL    IRRCSYNC                ;IRRCSync is just a delay module placed at the end of the program.
        CALL    CKBIT
                MOV     R5,#185         ;these DELAYS replaced the IR command recognition part, to "isolate" the problem code
temp:           CALL    IRRCSYNC
                DJNZ    R5,temp
        CALL    CKBIT                   ;This three CKBIT will be shown as a single LARGE pulse in PC
        CALL    CKBIT
        CALL    CKBIT
        CALL    IRRCSYNC                 ;a short delay so that the problem (INT again) can be shown clearly

                SETB    EX0
                RETI
;               ---------------------
IRRCSync:       MOV     R6,#10           ;Delay
IRRCSync6:      MOV     R7,#30
IRRCSync7:      DJNZ    R7,IRRCSync7
                DJNZ    R6,IRRCSync6
                RET
;               ---------------------
CKBIT:          SETB    CK               ;Debug pulse output.
                CLR     CK
                RET
;               ---------------------
                END
