Ok, It's not pretty, but it works, wrote it a long time ago. Hope this helps..
;******************************************************************************
; This file is a basic template for creating relocatable assembly code for *
; a PIC18F1320. *
;******************************************************************************
; Files required: P18F1320.INC *
;******************************************************************************
LIST P=18F1320, F=INHX32 ;directive to define processor and file format
#include <P18F1320.INC> ;processor specific variable definitions
;******************************************************************************
;Configuration bits
;; Oscillator Selection:
CONFIG OSC=INTIO2,LVP=OFF,WDT=OFF
;******************************************************************************
;Variable definitions
; These variables are only needed if low priority interrupts are used.
; More variables may be needed to store other special function registers used
; in the interrupt routines.
;
UDATA
;
WREG_TEMP RES 1 ;variable in RAM for context saving
STATUS_TEMP RES 1 ;variable in RAM for context saving
BSR_TEMP RES 1 ;variable in RAM for context saving
;
UDATA_ACS
;
EXAMPLE RES 1 ;example of a variable in access RAM
;
;;
cblock 0x01
d1
d2
d3
endc
;;
;******************************************************************************
;Reset vector
; This code will start executing when a reset occurs.
RESET_VECTOR CODE 0x0000
goto Main ;go to start of main code
;******************************************************************************
;High priority interrupt vector
; This code will start executing when a high priority interrupt occurs or
; when any interrupt occurs if interrupt priorities are not enabled.
HI_INT_VECTOR CODE 0x0008
bra HighInt ;go to high priority interrupt routine
;******************************************************************************
;Low priority interrupt vector
; This code will start executing when a low priority interrupt occurs.
; This code can be removed if low priority interrupts are not used.
LOW_INT_VECTOR CODE 0x0018
bra LowInt ;go to low priority interrupt routine
;******************************************************************************
;High priority interrupt routine
; The high priority interrupt code is placed here.
CODE
HighInt:
; *** high priority interrupt code goes here ***
retfie FAST
;******************************************************************************
;Low priority interrupt routine
; The low priority interrupt code is placed here.
; This code can be removed if low priority interrupts are not used.
LowInt:
movff STATUS,STATUS_TEMP ;save STATUS register
movff WREG,WREG_TEMP ;save working register
movff BSR,BSR_TEMP ;save BSR register
; *** low priority interrupt code goes here ***
movff BSR_TEMP,BSR ;restore BSR register
movff WREG_TEMP,WREG ;restore working register
movff STATUS_TEMP,STATUS ;restore STATUS register
retfie
;******************************************************************************
;Start of main program
;The main program code is placed here.
Main:
;
clrf LATB; clear output latch
movlw 0x7f
movwf ADCON1; set port b for digital inputs
bcf INTCON2, RBPU ; turn on soft pullups
;
;
BURP:
btfss PORTB, RB0; check for button #1 pressed
call BUTT1
btfss PORTB, RB2; check for button #2 pressed
call BUTT2
btfss PORTB, RB5; check for button #3 pressed
call BUTT3
;
goto BURP
;
L1:
LED1 bcf TRISA,0 ; RA0 output
bcf TRISA,6 ; RA6 output
bsf TRISA,7 ; RA7 tristate (open)
bsf LATA,0 ; RA6 High (5V)
bcf LATA,6 ; RA7 Low (GND)
call DubDelay
return
L2:
LED2 bcf TRISA,0 ; RA0 output
bcf TRISA,6 ; RA6 output
bsf TRISA,7 ; RA7 tristate (open)
bcf LATA,0 ; RA6 Low (GND)
bsf LATA,6 ; RA7 High (5V)
call DubDelay
return
L3:
LED3 bsf TRISA,0 ; RA0 tristate (open)
bcf TRISA,6 ; RA6 output
bcf TRISA,7 ; RA7 output
bsf LATA,6 ; RA6 High (5V)
bcf LATA,7 ; RA7 Low (GND)
call DubDelay
return
L4:
LED4 bsf TRISA,0 ; RA0 tristate (open)
bcf TRISA,6 ; RA6 output
bcf TRISA,7 ; RA7 output
bcf LATA,6 ; RA6 Low (GND)
bsf LATA,7 ; RA7 High (5V)
call DubDelay
return
L5:
LED5 bcf TRISA,0 ; RA0 output
bsf TRISA,6 ; RA6 tristate (open)
bcf TRISA,7 ; RA7 output
bcf LATA,0 ; RA0 Low (GND)
bsf LATA,7 ; RA7 High (5V)
call DubDelay
return
L6:
LED6 bcf TRISA,0 ; RA0 output
bsf TRISA,6 ; RA6 tristate (open)
bcf TRISA,7 ; RA7 output
bsf LATA,0 ; RA7 High (5V)
bcf LATA,7 ; RA6 Low (GND)
call DubDelay
;
return
;bra LED1 ; repeat
bra Main
;; END
;******************************************************************************
DubDelay
movlw 0xf0
movwf d1
movlw 0xf0
movwf d2
Del_1
decfsz d1, f
goto $+4
decfsz d2, f
goto Del_1
goto $+2
nop
return
;******************************************************************************
;******************************************************************************
;******************************************************************************
; Some test code
;
; clrf LATB; clear output latch
; movlw 0x7f
; movwf ADCON1; set port b for digital inputs
; btfss PORTB, RB0; check for button #1 pressed
; call BUTT1
; btfss PORTB, RB2; check for button #2 pressed
; call BUTT2
; btfss PORTB, RB5; check for button #3 pressed
; call BUTT3
;;
BUTT1
movlw 0x03
movwf d3
B11
call L1
call L2
call L3
call L4
call L5
call L6
decfsz d3, f
goto B11
bsf TRISA,0
bsf TRISA,6
bsf TRISA,7
return
BUTT2
movlw 0x03
movwf d3
B22
call L1
call L2
call L3
call L4
call L5
call L6
call L5
call L4
call L3
call L2
decfsz d3, f
goto B22
bsf TRISA,0
bsf TRISA,6
bsf TRISA,7
return
BUTT3
movlw 0x03
movwf d3
B33
call L3
call L4
decfsz d3, f
goto B33
bsf TRISA,0
bsf TRISA,6
bsf TRISA,7
return
END