eblc1388
Active Member
Joel Rainville said:Ok, now that it's clear what the algorithm is used for :lol:, my code isn't any faster than Nigel's suggestion of decrementing then testing.
And it is still one instruction more than not using the DECFSZ instruction.
Code:
;Code by Joel, 11 instructions
movf SEC, w
btfsc STATUS, Z
goto sec_zero
decfsz SEC, f
goto next_1
sec_zero:
movf MIN, w
btfsc STATUS, Z ; <MIN != 0>?
goto next_1
decf MIN, f
movlw D'59'
movwf SEC
next_1:
;Code by EBLC, 10 instructions
movf SEC,F
btfss STATUS,Z
goto next_0
movf MIN,F
btfsc STATUS,Z
goto next_1
decf MIN,F
movlw D'60'
movwf SEC
next_0:
decf SEC,F
next_1: