At 10:36 PM 10/15/01 +0200, Lasse Madsen wrote: >Hi all... > >I have a pice of code which is repeated 8 times, this consumes alot of >memory which i think could be spared (but im not sure) if assembler was as >easy as JAL or BASIC it wasnt a problem to optimize my code >but assembler is like school for me - you learn every day > > >number_1 >movlw 0xFF >movwf counter >loop BCF porta,01 > CALL pulse > BSF porta,01 > CALL pause_1 > decfsz counter,f > goto loop > BCF porta,01 > return > >The code from label: "number_1" to "return" is repeated 8 times with >different call pause_X numbers >If it was possible to make a procedure and call the pause number i could >save ALOT of code Turn the code from 'movwf counter' through 'return' into a subroutine. Then load W with your desired delay value and call the subroutine. The sub enters with the desired delay in W which is saved into the counter register by the first instruction of the subroutine. If you want to have a list of pre-determined delay values that are selected, consider using a jump table. dwayne Dwayne Reid Trinity Electronics Systems Ltd Edmonton, AB, CANADA (780) 489-3199 voice (780) 487-6397 fax Celebrating 17 years of Engineering Innovation (1984 - 2001) * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Do NOT send unsolicited commercial email to this email address. This message neither grants consent to receive unsolicited commercial email nor is intended to solicit commercial email. -- http://www.piclist.com hint: The list server can filter out subtopics (like ads or off topics) for you. See http://www.piclist.com/#topics