hi, this macro is 8 instructions long as yours, so no improvements in it; another way to do same variable sbl=0 ; decrement three-byte value (low byte at low address) decf3 macro var decf var,F incf var,W btfss STATUS,Z goto _sbl#v(sbl) decf var+1,F incf var+1,W btfsc STATUS,Z decf var+2,F _sbl#v(sbl): sbl = sbl+1 endm i tried to extend it to 4-byte decrement and here is it: ; decrement four-byte value decf4 macro var decf var,F incf var,W btfss STATUS,Z goto _sbl#v(sbl) decf var+1,F incf var+1,W btfss STATUS,Z goto _sbl#v(sbl) decf var+2,F incf var+2,W btfsc STATUS,Z decf var+3,F _sbl#v(sbl): sbl = sbl+1 endm so, four instructions per byte should be added. Ivan Cenov okto7@botev.ttm.bg http://www.geocities.com/SiliconValley/Network/9276/ Do what have to do, let happens what it wants. -----Original Message----- From: Bob Blick To: PICLIST@MITVMA.MIT.EDU Date: 12 ˉ‹—–˜ 1998 ‹., –ÝØŠˆ 19:35 Subject: 3 byte decrement >Hi Everyone, > >Usually I don't pay any attention to optimizing code, if it works I use >it, but this morning I'm feeling picky. No where in my notes do I have a >decrement for more than a 2 byte number. I want 3 bytes. This is what I >came up with. It looks stupid to me. Feel free to come up with something >better. It's for midrange pics and does not use any temporary registers. > >movlw 1 >subwf low,f >movlw 0 >SKPC >movlw 1 >subwf mid,f >SKPC >decf hi,f > >Any improvements on this? > >Thanks, >Bob >