Help please.

The PIC is an 18F8772 on a Futulec board (so hopefully the wiring is correct).
I'm trying to use assembler to make the MCU produce two pulse streams for a set number of pulses:

1. I use TIMER0 and TIMER1 for the inter-pulse delays.
2. A simple 'count down' for the pulse duration.
3. A counter that holds the numer of pulses to be generated, this is decremented - and when the counter hits zero - the routine should end.

The code works OK - BUT! keeps 're-running.' i.e it puts out the required number of pulses, pauses for a bit and then does it all over again.

Debugging with an ICD2 shows all the SFRs changing properly and the code ending after the requisite number of pulses - but when running normally it just keeps looping.

The last few lines of ASM code is

Code:
Main_loop:                   ; Check if X_steps_lb is zero			tstfsz	X_steps_lb   ; Test, skip next if equal
	goto	Main_loop    ; More steps to do, so loop	
	bcf	INTCON,7    ; Disable all high priority interrupts
	bcf	INTCON,6    ; Disable all low priority interrupts
	bcf	T0CON,7	    ; Timer0 off
	bcf	T1CON,0     ; Timer1 off	
	end
I've not posted all the code because I don't think anyone would trawl through it.

The CONFIG settings are:

Code:
                                           ;  Configuration bits
             CONFIG  OSC = HSPLL         ; Run at 4X speed
             CONFIG  CP0=OFF              ; Disable code protect		
             CONFIG  PWRT = OFF         ; Powerup off so DEBUG works            
             CONFIG  WDT=OFF             ; WDT off
             CONFIG  LVP = OFF            ; LVP off
             CONFIG  WAIT = OFF          ; External bus data wait disabled
The re-set on MLCR is OK. The IDE is MPLAB. Anyone got any ideas?

Regards Bill Legge