On Thu, 3 Apr 2008, Stephen D. Barnes wrote: > >> The following code is from the MPLab template for the dsPIC30F2010. >> Watching the W14 reg and running mpsim, W14 does pre-increments and >> throught the REPEAT loop >> achieves a value of 0x001A then is cleared to zero. What purpose does >> this serve? >> >> _wreg_init: >> CLR W0 >> MOV W0, W14 >> REPEAT #12 >> MOV W0, [++W14] >> CLR W14 >> RETURN >> > > It prevents buggy code from generating an uninitialized W register > reset, which is caused by using an uninitialized W register as an > address. This code pretty much defeats the whole point of the > uninitialized W register reset feature. > > -- > John W. Temples, III > But this is only doing something to W0 and W14...or am I wrong? I'm really trying to get my head around this! -- Regards, Stephen D. Barnes -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist