Not to disbelieve you Bob but just did a test with the help of my Mathias, typed in the following: bsf STATUS,Z ;Set zero bit movf STATUS,W ;Move STATUS into W register movwf STATUS ;Move W back into STATUS register bcf STATUS,Z ;Clear zero bit movf STATUS,W ;Move STATUS into W register movwf STATUS ;Move W back into STATUS register What I saw was the following: STATUS = 1A, W = xx bsf STATUS,Z ;Set zero bit STATUS = 1E, W = xx movf STATUS,W ;Move STATUS into W register STATUS = 1A, W = 1E movwf STATUS ;Move W back into STATUS register STATUS = 1E, W = 1E bcf STATUS,Z ;Clear zero bit STATUS = 1A, W = 1E movf STATUS,W ;Move STATUS into W register STATUS = 1A, W = 1A movwf STATUS ;Move W back into STATUS register STATUS = 1A, W = 1A Back to the drawing board. Bob Ammerman wrote: > > > org 4 > > >int > > > movwf W_TEMP ; "W_TEMP" in Banks 0 and 1 > > > movf STATUS, w > > > bcf STATUS, RP0 ; Set to Bank 0 > > > movwf STATUS_TEMP ; "STATUS_TEMP" in Bank 0 > > > > > > : > > > > > > movf STATUS_TEMP, w ; Restore "STATUS" > > > movwf STATUS > > > swapf W_TEMP, f ; Restore "w" without > > > swapf W_TEMP, w ; affecting STATUS > > > retfie > > > > Ouch, Myke. I just realized that this is wrong. > > > > You can't use "movf STATUS, W" because it can (and will) change the Zero > bit > > and affect the initial STATUS value. To move it into a temp location > > without affecting the original STATUS register, you have to use "swapf > > STATUS, W" and "movwf status_temp". Then to restore it, you just "swapf > > status_temp, W" and then use "movwf STATUS". > > Yeah, I think you _can_ use movf STATUS,W because the value it moves to W is > the value BEFORE the Z bit gets tweaked. > > Bob Ammerman > RAm Systems > (contract development of high performance, high function, low-level > software) > > -- > http://www.piclist.com hint: To leave the PICList > mailto:piclist-unsubscribe-request@mitvma.mit.edu -- http://www.piclist.com hint: To leave the PICList mailto:piclist-unsubscribe-request@mitvma.mit.edu