
_interrupt:

;RTCC.mbas,22 :: 		sub procedure interrupt
;RTCC.mbas,23 :: 		USB_Interrupt_Proc()
	CALL        _USB_Interrupt_Proc+0, 0
;RTCC.mbas,24 :: 		end sub
L_end_interrupt:
L__interrupt22:
	RETFIE      1
; end of _interrupt

_RTCC_WrEn:

;RTCC.mbas,26 :: 		sub procedure RTCC_WrEn 'Enables writing to the RTCC registers
;RTCC.mbas,27 :: 		EECON2 = 0x55
	MOVLW       85
	MOVWF       EECON2+0 
;RTCC.mbas,28 :: 		EECON2 = 0xAA
	MOVLW       170
	MOVWF       EECON2+0 
;RTCC.mbas,29 :: 		RTCWREN_bit = 1
	BSF         RTCWREN_bit+0, 5 
;RTCC.mbas,30 :: 		end sub
L_end_RTCC_WrEn:
	RETURN      0
; end of _RTCC_WrEn

_RTCC_Read:

;RTCC.mbas,32 :: 		sub procedure RTCC_Read() 'Reads from the RTCC
;RTCC.mbas,33 :: 		RTCCFG = %10000011 'Set RTCPTR to 11
	MOVLW       131
	MOVWF       RTCCFG+0 
;RTCC.mbas,34 :: 		while RTCSYNC_bit = 1
L__RTCC_Read4:
	BTFSC       RTCSYNC_bit+0, 4 
	GOTO        L__RTCC_Read4
;RTCC.mbas,37 :: 		bytYear   = Bcd2Dec(RTCVALL)
	MOVF        RTCVALL+0, 0 
	MOVWF       FARG_Bcd2Dec_bcd_num+0 
	CALL        _Bcd2Dec+0, 0
	MOVF        R0, 0 
	MOVWF       _bytYear+0 
;RTCC.mbas,38 :: 		bytMonth  = Bcd2Dec(RTCVALH) 'Just to decrement RTCPTR
	MOVF        RTCVALH+0, 0 
	MOVWF       FARG_Bcd2Dec_bcd_num+0 
	CALL        _Bcd2Dec+0, 0
	MOVF        R0, 0 
	MOVWF       _bytMonth+0 
;RTCC.mbas,39 :: 		bytDay    = Bcd2Dec(RTCVALL)
	MOVF        RTCVALL+0, 0 
	MOVWF       FARG_Bcd2Dec_bcd_num+0 
	CALL        _Bcd2Dec+0, 0
	MOVF        R0, 0 
	MOVWF       _bytDay+0 
;RTCC.mbas,40 :: 		bytMonth  = Bcd2Dec(RTCVALH)
	MOVF        RTCVALH+0, 0 
	MOVWF       FARG_Bcd2Dec_bcd_num+0 
	CALL        _Bcd2Dec+0, 0
	MOVF        R0, 0 
	MOVWF       _bytMonth+0 
;RTCC.mbas,41 :: 		bytHour   = Bcd2Dec(RTCVALL)
	MOVF        RTCVALL+0, 0 
	MOVWF       FARG_Bcd2Dec_bcd_num+0 
	CALL        _Bcd2Dec+0, 0
	MOVF        R0, 0 
	MOVWF       _bytHour+0 
;RTCC.mbas,42 :: 		bytWkDay  = Bcd2Dec(RTCVALH)
	MOVF        RTCVALH+0, 0 
	MOVWF       FARG_Bcd2Dec_bcd_num+0 
	CALL        _Bcd2Dec+0, 0
	MOVF        R0, 0 
	MOVWF       _bytWkDay+0 
;RTCC.mbas,43 :: 		bytSecond = Bcd2Dec(RTCVALL)
	MOVF        RTCVALL+0, 0 
	MOVWF       FARG_Bcd2Dec_bcd_num+0 
	CALL        _Bcd2Dec+0, 0
	MOVF        R0, 0 
	MOVWF       _bytSecond+0 
;RTCC.mbas,44 :: 		bytMinute = Bcd2Dec(RTCVALH)
	MOVF        RTCVALH+0, 0 
	MOVWF       FARG_Bcd2Dec_bcd_num+0 
	CALL        _Bcd2Dec+0, 0
	MOVF        R0, 0 
	MOVWF       _bytMinute+0 
;RTCC.mbas,45 :: 		end sub
L_end_RTCC_Read:
	RETURN      0
; end of _RTCC_Read

_RTCC_Write:

;RTCC.mbas,47 :: 		sub procedure RTCC_Write() 'Writes to the RTCC
;RTCC.mbas,48 :: 		RTCC_WrEn
	CALL        _RTCC_WrEn+0, 0
;RTCC.mbas,49 :: 		RTCCFG = %10100011 'Set RTCPTR to 11
	MOVLW       163
	MOVWF       RTCCFG+0 
;RTCC.mbas,50 :: 		RTCVALL = Dec2Bcd(bytYear)
	MOVF        _bytYear+0, 0 
	MOVWF       FARG_Dec2Bcd_decnum+0 
	CALL        _Dec2Bcd+0, 0
	MOVF        R0, 0 
	MOVWF       RTCVALL+0 
;RTCC.mbas,51 :: 		RTCVALH = Dec2Bcd(bytMonth) 'Just to decrement RTCPTR
	MOVF        _bytMonth+0, 0 
	MOVWF       FARG_Dec2Bcd_decnum+0 
	CALL        _Dec2Bcd+0, 0
	MOVF        R0, 0 
	MOVWF       RTCVALH+0 
;RTCC.mbas,52 :: 		RTCVALL = Dec2Bcd(bytDay)
	MOVF        _bytDay+0, 0 
	MOVWF       FARG_Dec2Bcd_decnum+0 
	CALL        _Dec2Bcd+0, 0
	MOVF        R0, 0 
	MOVWF       RTCVALL+0 
;RTCC.mbas,53 :: 		RTCVALH = Dec2Bcd(bytMonth)
	MOVF        _bytMonth+0, 0 
	MOVWF       FARG_Dec2Bcd_decnum+0 
	CALL        _Dec2Bcd+0, 0
	MOVF        R0, 0 
	MOVWF       RTCVALH+0 
;RTCC.mbas,54 :: 		RTCVALL = Dec2Bcd(bytHour)
	MOVF        _bytHour+0, 0 
	MOVWF       FARG_Dec2Bcd_decnum+0 
	CALL        _Dec2Bcd+0, 0
	MOVF        R0, 0 
	MOVWF       RTCVALL+0 
;RTCC.mbas,55 :: 		RTCVALH = Dec2Bcd(bytWkDay)
	MOVF        _bytWkDay+0, 0 
	MOVWF       FARG_Dec2Bcd_decnum+0 
	CALL        _Dec2Bcd+0, 0
	MOVF        R0, 0 
	MOVWF       RTCVALH+0 
;RTCC.mbas,56 :: 		RTCVALL = Dec2Bcd(bytSecond)
	MOVF        _bytSecond+0, 0 
	MOVWF       FARG_Dec2Bcd_decnum+0 
	CALL        _Dec2Bcd+0, 0
	MOVF        R0, 0 
	MOVWF       RTCVALL+0 
;RTCC.mbas,57 :: 		RTCVALH = Dec2Bcd(bytMinute)
	MOVF        _bytMinute+0, 0 
	MOVWF       FARG_Dec2Bcd_decnum+0 
	CALL        _Dec2Bcd+0, 0
	MOVF        R0, 0 
	MOVWF       RTCVALH+0 
;RTCC.mbas,58 :: 		RTCWREN_bit = 0
	BCF         RTCWREN_bit+0, 5 
;RTCC.mbas,59 :: 		end sub
L_end_RTCC_Write:
	RETURN      0
; end of _RTCC_Write

_GenerateDigits:

;RTCC.mbas,61 :: 		sub procedure GenerateDigits(dim value as byte, dim pos as ^char)
;RTCC.mbas,62 :: 		pos^ = (value div 10) + 48
	MOVLW       10
	MOVWF       R4 
	MOVF        FARG_GenerateDigits_value+0, 0 
	MOVWF       R0 
	CALL        _Div_8x8_U+0, 0
	MOVFF       FARG_GenerateDigits_pos+0, FSR1
	MOVFF       FARG_GenerateDigits_pos+1, FSR1H
	MOVLW       48
	ADDWF       R0, 0 
	MOVWF       POSTINC1+0 
;RTCC.mbas,63 :: 		Inc(pos)
	INFSNZ      FARG_GenerateDigits_pos+0, 1 
	INCF        FARG_GenerateDigits_pos+1, 1 
;RTCC.mbas,64 :: 		pos^ = (value mod 10) + 48
	MOVLW       10
	MOVWF       R4 
	MOVF        FARG_GenerateDigits_value+0, 0 
	MOVWF       R0 
	CALL        _Div_8x8_U+0, 0
	MOVF        R8, 0 
	MOVWF       R0 
	MOVFF       FARG_GenerateDigits_pos+0, FSR1
	MOVFF       FARG_GenerateDigits_pos+1, FSR1H
	MOVLW       48
	ADDWF       R0, 0 
	MOVWF       POSTINC1+0 
;RTCC.mbas,65 :: 		end sub
L_end_GenerateDigits:
	RETURN      0
; end of _GenerateDigits

_GenerateRTCCString:

;RTCC.mbas,68 :: 		dim pos as ^char
;RTCC.mbas,69 :: 		pos = @rtccstring
	MOVF        FARG_GenerateRTCCString_rtccstring+0, 0 
	MOVWF       GenerateRTCCString_pos+0 
	MOVF        FARG_GenerateRTCCString_rtccstring+1, 0 
	MOVWF       GenerateRTCCString_pos+1 
;RTCC.mbas,70 :: 		rtccstring = "00-00-00 00:00:00"
	MOVF        FARG_GenerateRTCCString_rtccstring+0, 0 
	MOVWF       FSR1 
	MOVF        FARG_GenerateRTCCString_rtccstring+1, 0 
	MOVWF       FSR1H 
	MOVLW       48
	MOVWF       POSTINC1+0 
	MOVLW       48
	MOVWF       POSTINC1+0 
	MOVLW       45
	MOVWF       POSTINC1+0 
	MOVLW       48
	MOVWF       POSTINC1+0 
	MOVLW       48
	MOVWF       POSTINC1+0 
	MOVLW       45
	MOVWF       POSTINC1+0 
	MOVLW       48
	MOVWF       POSTINC1+0 
	MOVLW       48
	MOVWF       POSTINC1+0 
	MOVLW       32
	MOVWF       POSTINC1+0 
	MOVLW       48
	MOVWF       POSTINC1+0 
	MOVLW       48
	MOVWF       POSTINC1+0 
	MOVLW       58
	MOVWF       POSTINC1+0 
	MOVLW       48
	MOVWF       POSTINC1+0 
	MOVLW       48
	MOVWF       POSTINC1+0 
	MOVLW       58
	MOVWF       POSTINC1+0 
	MOVLW       48
	MOVWF       POSTINC1+0 
	MOVLW       48
	MOVWF       POSTINC1+0 
	CLRF        POSTINC1+0 
;RTCC.mbas,71 :: 		GenerateDigits(bytYear, pos)
	MOVF        _bytYear+0, 0 
	MOVWF       FARG_GenerateDigits_value+0 
	MOVF        GenerateRTCCString_pos+0, 0 
	MOVWF       FARG_GenerateDigits_pos+0 
	MOVF        GenerateRTCCString_pos+1, 0 
	MOVWF       FARG_GenerateDigits_pos+1 
	CALL        _GenerateDigits+0, 0
;RTCC.mbas,72 :: 		pos = pos + 3
	MOVLW       3
	ADDWF       GenerateRTCCString_pos+0, 0 
	MOVWF       R0 
	MOVLW       0
	ADDWFC      GenerateRTCCString_pos+1, 0 
	MOVWF       R1 
	MOVF        R0, 0 
	MOVWF       GenerateRTCCString_pos+0 
	MOVF        R1, 0 
	MOVWF       GenerateRTCCString_pos+1 
;RTCC.mbas,73 :: 		GenerateDigits(bytMonth, pos)
	MOVF        _bytMonth+0, 0 
	MOVWF       FARG_GenerateDigits_value+0 
	MOVF        R0, 0 
	MOVWF       FARG_GenerateDigits_pos+0 
	MOVF        R1, 0 
	MOVWF       FARG_GenerateDigits_pos+1 
	CALL        _GenerateDigits+0, 0
;RTCC.mbas,74 :: 		pos = pos + 3
	MOVLW       3
	ADDWF       GenerateRTCCString_pos+0, 0 
	MOVWF       R0 
	MOVLW       0
	ADDWFC      GenerateRTCCString_pos+1, 0 
	MOVWF       R1 
	MOVF        R0, 0 
	MOVWF       GenerateRTCCString_pos+0 
	MOVF        R1, 0 
	MOVWF       GenerateRTCCString_pos+1 
;RTCC.mbas,75 :: 		GenerateDigits(bytDay, pos)
	MOVF        _bytDay+0, 0 
	MOVWF       FARG_GenerateDigits_value+0 
	MOVF        R0, 0 
	MOVWF       FARG_GenerateDigits_pos+0 
	MOVF        R1, 0 
	MOVWF       FARG_GenerateDigits_pos+1 
	CALL        _GenerateDigits+0, 0
;RTCC.mbas,76 :: 		pos = pos + 3
	MOVLW       3
	ADDWF       GenerateRTCCString_pos+0, 0 
	MOVWF       R0 
	MOVLW       0
	ADDWFC      GenerateRTCCString_pos+1, 0 
	MOVWF       R1 
	MOVF        R0, 0 
	MOVWF       GenerateRTCCString_pos+0 
	MOVF        R1, 0 
	MOVWF       GenerateRTCCString_pos+1 
;RTCC.mbas,77 :: 		GenerateDigits(bytHour, pos)
	MOVF        _bytHour+0, 0 
	MOVWF       FARG_GenerateDigits_value+0 
	MOVF        R0, 0 
	MOVWF       FARG_GenerateDigits_pos+0 
	MOVF        R1, 0 
	MOVWF       FARG_GenerateDigits_pos+1 
	CALL        _GenerateDigits+0, 0
;RTCC.mbas,78 :: 		pos = pos + 3
	MOVLW       3
	ADDWF       GenerateRTCCString_pos+0, 0 
	MOVWF       R0 
	MOVLW       0
	ADDWFC      GenerateRTCCString_pos+1, 0 
	MOVWF       R1 
	MOVF        R0, 0 
	MOVWF       GenerateRTCCString_pos+0 
	MOVF        R1, 0 
	MOVWF       GenerateRTCCString_pos+1 
;RTCC.mbas,79 :: 		GenerateDigits(bytMinute, pos)
	MOVF        _bytMinute+0, 0 
	MOVWF       FARG_GenerateDigits_value+0 
	MOVF        R0, 0 
	MOVWF       FARG_GenerateDigits_pos+0 
	MOVF        R1, 0 
	MOVWF       FARG_GenerateDigits_pos+1 
	CALL        _GenerateDigits+0, 0
;RTCC.mbas,80 :: 		pos = pos + 3
	MOVLW       3
	ADDWF       GenerateRTCCString_pos+0, 0 
	MOVWF       R0 
	MOVLW       0
	ADDWFC      GenerateRTCCString_pos+1, 0 
	MOVWF       R1 
	MOVF        R0, 0 
	MOVWF       GenerateRTCCString_pos+0 
	MOVF        R1, 0 
	MOVWF       GenerateRTCCString_pos+1 
;RTCC.mbas,81 :: 		GenerateDigits(bytSecond, pos)
	MOVF        _bytSecond+0, 0 
	MOVWF       FARG_GenerateDigits_value+0 
	MOVF        R0, 0 
	MOVWF       FARG_GenerateDigits_pos+0 
	MOVF        R1, 0 
	MOVWF       FARG_GenerateDigits_pos+1 
	CALL        _GenerateDigits+0, 0
;RTCC.mbas,82 :: 		pos = pos + 3
	MOVLW       3
	ADDWF       GenerateRTCCString_pos+0, 0 
	MOVWF       R0 
	MOVLW       0
	ADDWFC      GenerateRTCCString_pos+1, 0 
	MOVWF       R1 
	MOVF        R0, 0 
	MOVWF       GenerateRTCCString_pos+0 
	MOVF        R1, 0 
	MOVWF       GenerateRTCCString_pos+1 
;RTCC.mbas,83 :: 		pos^ = 0
	MOVFF       R0, FSR1
	MOVFF       R1, FSR1H
	CLRF        POSTINC1+0 
;RTCC.mbas,84 :: 		end sub
L_end_GenerateRTCCString:
	RETURN      0
; end of _GenerateRTCCString

_USB_RTCC:

;RTCC.mbas,86 :: 		sub procedure USB_RTCC
;RTCC.mbas,87 :: 		GenerateRTCCString(USBout)
	MOVLW       _USBout+0
	MOVWF       FARG_GenerateRTCCString_rtccstring+0 
	MOVLW       hi_addr(_USBout+0)
	MOVWF       FARG_GenerateRTCCString_rtccstring+1 
	CALL        _GenerateRTCCString+0, 0
;RTCC.mbas,88 :: 		strcat(USBout, chr(13) + chr(10))
	MOVLW       _USBout+0
	MOVWF       FARG_strcat_s1+0 
	MOVLW       hi_addr(_USBout+0)
	MOVWF       FARG_strcat_s1+1 
	MOVLW       13
	MOVWF       ?LocalText_USB_RTCC+0 
	MOVLW       10
	MOVWF       ?LocalText_USB_RTCC+1 
	MOVLW       0
	MOVWF       ?LocalText_USB_RTCC+2 
	MOVLW       ?LocalText_USB_RTCC+0
	MOVWF       FARG_strcat_s2+0 
	MOVLW       hi_addr(?LocalText_USB_RTCC+0)
	MOVWF       FARG_strcat_s2+1 
	CALL        _strcat+0, 0
;RTCC.mbas,89 :: 		HID_Write(@USBout, 64)
	MOVLW       _USBout+0
	MOVWF       FARG_HID_Write_writebuff+0 
	MOVLW       hi_addr(_USBout+0)
	MOVWF       FARG_HID_Write_writebuff+1 
	MOVLW       64
	MOVWF       FARG_HID_Write_len+0 
	CALL        _HID_Write+0, 0
;RTCC.mbas,90 :: 		end sub
L_end_USB_RTCC:
	RETURN      0
; end of _USB_RTCC

_TestRTCC_Write:

;RTCC.mbas,92 :: 		sub procedure TestRTCC_Write
;RTCC.mbas,93 :: 		bytYear = 86
	MOVLW       86
	MOVWF       _bytYear+0 
;RTCC.mbas,94 :: 		bytMonth = 07
	MOVLW       7
	MOVWF       _bytMonth+0 
;RTCC.mbas,95 :: 		bytDay = 12
	MOVLW       12
	MOVWF       _bytDay+0 
;RTCC.mbas,96 :: 		bytHour = 05
	MOVLW       5
	MOVWF       _bytHour+0 
;RTCC.mbas,97 :: 		bytMinute = 08
	MOVLW       8
	MOVWF       _bytMinute+0 
;RTCC.mbas,98 :: 		bytSecond = 03
	MOVLW       3
	MOVWF       _bytSecond+0 
;RTCC.mbas,99 :: 		RTCC_Write
	CALL        _RTCC_Write+0, 0
;RTCC.mbas,100 :: 		end sub
L_end_TestRTCC_Write:
	RETURN      0
; end of _TestRTCC_Write

_main:

;RTCC.mbas,102 :: 		main:
;RTCC.mbas,103 :: 		OSCCON = %01110000 '8MHz
	MOVLW       112
	MOVWF       OSCCON+0 
;RTCC.mbas,104 :: 		PLLEn_bit = 1 'Enable PLL (now 48MHz)
	BSF         PLLEN_bit+0, 6 
;RTCC.mbas,107 :: 		T1OSCEN_bit = 1
	BSF         T1OSCEN_bit+0, 3 
;RTCC.mbas,108 :: 		RTCC_WrEn
	CALL        _RTCC_WrEn+0, 0
;RTCC.mbas,109 :: 		RTCEN_bit = 1
	BSF         RTCEN_bit+0, 7 
;RTCC.mbas,110 :: 		RTCWREN_Bit = 0
	BCF         RTCWREN_bit+0, 5 
;RTCC.mbas,112 :: 		HID_Enable(@USBin, @USBout)
	MOVLW       _USBin+0
	MOVWF       FARG_HID_Enable_readbuff+0 
	MOVLW       hi_addr(_USBin+0)
	MOVWF       FARG_HID_Enable_readbuff+1 
	MOVLW       _USBout+0
	MOVWF       FARG_HID_Enable_writebuff+0 
	MOVLW       hi_addr(_USBout+0)
	MOVWF       FARG_HID_Enable_writebuff+1 
	CALL        _HID_Enable+0, 0
;RTCC.mbas,113 :: 		USBout = "Breeze RTCC" + chr(13) + chr(10)
	MOVLW       66
	MOVWF       _USBout+0 
	MOVLW       114
	MOVWF       _USBout+1 
	MOVLW       101
	MOVWF       _USBout+2 
	MOVLW       101
	MOVWF       _USBout+3 
	MOVLW       122
	MOVWF       _USBout+4 
	MOVLW       101
	MOVWF       _USBout+5 
	MOVLW       32
	MOVWF       _USBout+6 
	MOVLW       82
	MOVWF       _USBout+7 
	MOVLW       84
	MOVWF       _USBout+8 
	MOVLW       67
	MOVWF       _USBout+9 
	MOVLW       67
	MOVWF       _USBout+10 
	MOVLW       13
	MOVWF       _USBout+11 
	MOVLW       10
	MOVWF       _USBout+12 
	MOVLW       0
	MOVWF       _USBout+13 
;RTCC.mbas,114 :: 		HID_Write(@USBout, 64)
	MOVLW       _USBout+0
	MOVWF       FARG_HID_Write_writebuff+0 
	MOVLW       hi_addr(_USBout+0)
	MOVWF       FARG_HID_Write_writebuff+1 
	MOVLW       64
	MOVWF       FARG_HID_Write_len+0 
	CALL        _HID_Write+0, 0
;RTCC.mbas,116 :: 		TestRTCC_Write
	CALL        _TestRTCC_Write+0, 0
;RTCC.mbas,118 :: 		TRISC2_bit = 0
	BCF         TRISC2_bit+0, 2 
;RTCC.mbas,119 :: 		LATC2_bit = 0
	BCF         LATC2_bit+0, 2 
;RTCC.mbas,121 :: 		while(1)
L__main15:
;RTCC.mbas,122 :: 		LATC2_bit = 1
	BSF         LATC2_bit+0, 2 
;RTCC.mbas,123 :: 		RTCC_Read
	CALL        _RTCC_Read+0, 0
;RTCC.mbas,124 :: 		USB_RTCC
	CALL        _USB_RTCC+0, 0
;RTCC.mbas,125 :: 		delay_ms(100)
	MOVLW       7
	MOVWF       R11, 0
	MOVLW       23
	MOVWF       R12, 0
	MOVLW       106
	MOVWF       R13, 0
L__main19:
	DECFSZ      R13, 1, 1
	BRA         L__main19
	DECFSZ      R12, 1, 1
	BRA         L__main19
	DECFSZ      R11, 1, 1
	BRA         L__main19
	NOP
;RTCC.mbas,126 :: 		LATC2_bit = 0
	BCF         LATC2_bit+0, 2 
;RTCC.mbas,127 :: 		delay_ms(900)
	MOVLW       55
	MOVWF       R11, 0
	MOVLW       202
	MOVWF       R12, 0
	MOVLW       211
	MOVWF       R13, 0
L__main20:
	DECFSZ      R13, 1, 1
	BRA         L__main20
	DECFSZ      R12, 1, 1
	BRA         L__main20
	DECFSZ      R11, 1, 1
	BRA         L__main20
;RTCC.mbas,128 :: 		wend
	GOTO        L__main15
L_end_main:
	GOTO        $+0
; end of _main
