; This file was generated by C2C compiler

	include "p16c84.inc"

	title "Variables *****************************************"
__res	equ 0xc
__cnt	equ 0xd
param00_delay_ms	equ 0xe
_loop2_delay_ms	equ 0xf
_loop1_delay_ms	equ 0x10
param00_lcd_putc	equ 0x11
_sertime_lcd_putc	equ 0x12
param00_lcd_printdec	equ 0x13
_count_lcd_printdec	equ 0x14
param00_lcd_printhex	equ 0x15
_nibble_lcd_printhex	equ 0x16
param00_lcd_printbin	equ 0x17
_bits_lcd_printbin	equ 0x18
_i_lcd_printbin	equ 0x20
param00_lcd_goto	equ 0x21
param01_lcd_goto	equ 0x22
_count_delay_us	equ 0x23
_count2_delay_us	equ 0x24
param00_delay_s	equ 0x25
_i_delay_s	equ 0x26
_i_main	equ 0x27

	ORG 0
	goto go

	ORG 4
_interrupt
	bcf INTCON, T0IF		;clear interrupt flag
	retfie

go
_main
	bsf STATUS, RP0
	bcf TRISA, 1
	bcf STATUS, RP0
	movlw D'1'
	movwf param00_delay_s
	call _delay_s
	call _lcd_clear
	movlw D'1'
	movwf param00_delay_s
	call _delay_s
label_20
	movlw D'1'
	sublw 0
	btfsc STATUS, Z
	goto label_21
	movlw D'32'
	movwf _i_main
label_22
	movlw D'128'
	subwf _i_main, W
	movlw 1
	btfsc STATUS, C
	clrw
	sublw 0
	btfsc STATUS, Z
	goto label_23
	movf _i_main, W
	movwf param00_lcd_putc
	call _lcd_putc
	movlw D'0'
	movwf param00_lcd_goto
	movlw D'5'
	movwf param01_lcd_goto
	call _lcd_goto
	movf _i_main, W
	movwf param00_lcd_printdec
	call _lcd_printdec
	movlw D'0'
	movwf param00_lcd_goto
	movlw D'10'
	movwf param01_lcd_goto
	call _lcd_goto
	movf _i_main, W
	movwf param00_lcd_printhex
	call _lcd_printhex
	movlw D'1'
	movwf param00_lcd_goto
	movlw D'2'
	movwf param01_lcd_goto
	call _lcd_goto
	movf _i_main, W
	movwf param00_lcd_printbin
	call _lcd_printbin
	movlw D'1'
	movwf param00_delay_s
	call _delay_s
	call _lcd_clear
	incf _i_main, F
	goto label_22
label_23
	goto label_20
label_21
_delay_ms
	movf param00_delay_ms, W
	movwf _loop1_delay_ms

	MOVLW   110    ; close to 1.0 msec delay when set to .110
	MOVWF   _loop2_delay_ms

	NOP
	NOP
	NOP
	NOP
	NOP
	NOP
	DECFSZ  _loop2_delay_ms, F   ; decrement and leave result in LOOP2
	; skip next statement if zero
	GOTO $-7                ; goto _DELAY_2
	DECFSZ  _loop1_delay_ms, F
	GOTO $-0xb              ; goto _DELAY_1
	return
_lcd_putc
	bcf PORTA, 1
	movlw D'255'
	movwf _sertime_lcd_putc
label_0
	movf _sertime_lcd_putc, W
	sublw D'0'
	movlw 1
	btfsc STATUS, Z
	clrw
	decf _sertime_lcd_putc, F
	sublw 0
	btfsc STATUS, Z
	goto label_1
	goto label_0
label_1
	movlw 9		; 8 data + 1 start 
	clrc		; start bit

	skpnc	        ; bit time = 104.167 uSec
	bcf PORTA, 1
	skpc
	bsf PORTA, 1

	; 95 clk cycle delay
	goto $+1            ; 2-cycle NOP in 1 instruction!
	addlw b'00010000'	; increment upper nibble
	skpc		; delay = 6n -1 (1 less when falls thru)
	goto $-3   	; goto lcddloop loop sixteen times
	addlw -1		; dec w, valid z, c=1 if w=0 after decrement
	rrf param00_lcd_putc,F	; carry will be set - shifted in as stop bit
	skpz
	goto $-0xb        ; goto lcdtxloop txloop is 104 clk cycles
	bcf PORTA, 1
	movlw D'10'
	movwf param00_delay_ms
	call _delay_ms
	return
_lcd_clear
	movlw D'254'
	movwf param00_lcd_putc
	call _lcd_putc
	movlw D'1'
	movwf param00_lcd_putc
	call _lcd_putc
	return
_lcd_printdec
	movlw D'0'
	movwf _count_lcd_printdec
label_2
	movf param00_lcd_printdec, W
	sublw D'99'
	movlw 1
	btfsc STATUS, C
	clrw
	sublw 0
	btfsc STATUS, Z
	goto label_3
	movlw D'100'
	subwf param00_lcd_printdec, W
	movwf param00_lcd_printdec
	movf _count_lcd_printdec, W
	incf _count_lcd_printdec, F
	goto label_2
label_3
	movlw D'48'
	addwf _count_lcd_printdec, W
	movwf param00_lcd_putc
	call _lcd_putc
	movlw D'0'
	movwf _count_lcd_printdec
label_4
	movf param00_lcd_printdec, W
	sublw D'9'
	movlw 1
	btfsc STATUS, C
	clrw
	sublw 0
	btfsc STATUS, Z
	goto label_5
	movlw D'10'
	subwf param00_lcd_printdec, W
	movwf param00_lcd_printdec
	movf _count_lcd_printdec, W
	incf _count_lcd_printdec, F
	goto label_4
label_5
	movlw D'48'
	addwf _count_lcd_printdec, W
	movwf param00_lcd_putc
	call _lcd_putc
	movlw D'48'
	addwf param00_lcd_printdec, W
	movwf param00_lcd_putc
	call _lcd_putc
	return
_lcd_printhex
	movf param00_lcd_printhex, W
	andlw D'240'
	movwf _nibble_lcd_printhex
	swapf _nibble_lcd_printhex, f;
	movlw D'10'
	subwf _nibble_lcd_printhex, W
	movlw 1
	btfsc STATUS, C
	clrw
	sublw 0
	btfsc STATUS, Z
	goto label_6
	movlw D'48'
	addwf _nibble_lcd_printhex, W
	movwf param00_lcd_putc
	call _lcd_putc
	goto label_7
label_6
	movlw D'10'
	subwf _nibble_lcd_printhex, W
	addlw D'65'
	movwf param00_lcd_putc
	call _lcd_putc
label_7
	movf param00_lcd_printhex, W
	andlw D'15'
	movwf _nibble_lcd_printhex
	movlw D'10'
	subwf _nibble_lcd_printhex, W
	movlw 1
	btfsc STATUS, C
	clrw
	sublw 0
	btfsc STATUS, Z
	goto label_8
	movlw D'48'
	addwf _nibble_lcd_printhex, W
	movwf param00_lcd_putc
	call _lcd_putc
	goto label_9
label_8
	movlw D'10'
	subwf _nibble_lcd_printhex, W
	addlw D'65'
	movwf param00_lcd_putc
	call _lcd_putc
label_9
	return
_lcd_printbin
	movlw D'128'
	movwf _bits_lcd_printbin+D'0'
	movlw D'64'
	movwf _bits_lcd_printbin+D'1'
	movlw D'32'
	movwf _bits_lcd_printbin+D'2'
	movlw D'16'
	movwf _bits_lcd_printbin+D'3'
	movlw D'8'
	movwf _bits_lcd_printbin+D'4'
	movlw D'4'
	movwf _bits_lcd_printbin+D'5'
	movlw D'2'
	movwf _bits_lcd_printbin+D'6'
	movlw D'1'
	movwf _bits_lcd_printbin+D'7'
	movlw D'0'
	movwf _i_lcd_printbin
label_10
	movlw D'8'
	subwf _i_lcd_printbin, W
	movlw 1
	btfsc STATUS, C
	clrw
	sublw 0
	btfsc STATUS, Z
	goto label_11
	movf _i_lcd_printbin, W
	addlw _bits_lcd_printbin
	movwf FSR
	movf INDF, W
	andwf param00_lcd_printbin, W
	sublw 0
	btfsc STATUS, Z
	goto label_12
	movlw D'49'
	movwf param00_lcd_putc
	call _lcd_putc
	goto label_13
label_12
	movlw D'48'
	movwf param00_lcd_putc
	call _lcd_putc
label_13
	movf _i_lcd_printbin, W
	incf _i_lcd_printbin, F
	goto label_10
label_11
	return
_lcd_goto
	movlw D'254'
	movwf param00_lcd_putc
	call _lcd_putc
	clrf __res
	movf param00_lcd_goto, W
	movwf __cnt
mul0	movlw 64
	addwf __res, F
	decfsz __cnt, F
	goto mul0
	movf __res, W
	addlw D'128'
	addwf param01_lcd_goto, W
	movwf param00_lcd_putc
	call _lcd_putc
	return
_delay_s
	movlw D'0'
	movwf _i_delay_s
label_18
	movlw D'10'
	subwf _i_delay_s, W
	movlw 1
	btfsc STATUS, C
	clrw
	sublw 0
	btfsc STATUS, Z
	goto label_19
	movlw D'100'
	movwf param00_delay_ms
	call _delay_ms
	incf _i_delay_s, F
	goto label_18
label_19
	return

	END
