Shane Nelson wrote: > The goal is to have a routine that increments and keeps track of > time in a BCD format. > > Points are scored as follows: > 1 point for each ROM location used. > 3 for each RAM. > > My code scores 43 points. Best score is the lowest. > Haven't tested it yet so I dont know if it works or not. Shane: Your code doesn't work; neither does Tony Nixon's. This code DOES work; it increments the time, stored in packed-BCD format (two decimal digits per byte) in registers HOURS, MINUTES, and SECONDS. It uses those three registers plus the FSR, and 24 words of ROM (including the RETURN). It'll run on any of the PICs, including the 12-bit parts. SECONDS, MINUTES, and HOURS must be stored in consecutive registers, in that order... But they can be on any register-page. By my count, this routine scores 4 * 3 + 24 = 36 points. I expect, of course, that John, Scott or Dmitri will be able to do better. TICK: MOVLW SECONDS MOVWF FSR CALL SUB1 CALL SUB0 CALL SUB0 ADDWF INDF,W SKPNC CLRF INDF RETURN SUB0: INCF FSR SKPNC SUB1: INCF INDF MOVLW 6 ADDWF INDF,W XORWF INDF,W ANDLW 11110000B MOVLW 6 SKPNZ ADDWF INDF MOVLW 0100H - 060H ADDWF INDF,W SKPNC CLRF INDF RETLW 0100H - 024H -Andy === Andrew Warren - fastfwd@ix.netcom.com === Fast Forward Engineering - Vista, California === http://www.geocities.com/SiliconValley/2499 === For PICLIST help (including "unsubscribe" instructions), === put the single word "help" in the body of a message and === send it to: listserv@mitvma.mit.edu