18C instruction??

Thread Starter

MaxHeadRoom

Joined Jul 18, 2013
30,661
I am in the process of converting some math routines that were supposedly written for 18C but I cannot find a description in the general 18C Picmicro manual.
The instruction is 'subwfc' I am assuming it is subtract wreg from file with carry?
Also what would be the = for 18f series?
Anyone know for sure.
Max.
 

Papabravo

Joined Feb 24, 2006
22,082
I am in the process of converting some math routines that were supposedly written for 18C but I cannot find a description in the general 18C Picmicro manual.
The instruction is 'subwfc' I am assuming it is subtract wreg from file with carry?
Also what would be the = for 18f series?
Anyone know for sure.
Max.
It might be a macro defined in the particular assembler/compiler used on the original library. This often happens in math libraries, because remembering how subtract with carry works, can be a mind bender.

Good Luck on your search for an answer.
 

Thread Starter

MaxHeadRoom

Joined Jul 18, 2013
30,661
Thanks, I suspect it is not a macro, this was the comment in the orig file: subwfc x_hi, w ; only works on 18cxxx chips !
I have found SUBDCF etc and equivalent.
Max.
 

jpanhalt

Joined Jan 18, 2008
11,087
Given that syntax and some other evidence it is identical to the current subwfb
1) With the early chips the pseudo code skpnc and skpc were used in the same way with 18C chips as they are used today (old PicList)
2) Here is an exampleof how subwfb is worked:
Code:
;T1-T2  when T1 = T2, Status,C is set
;works   T2 is preserved
     movf      T2L,w     ;
     subwf     T1L,f     ;
     movf      T2H,w     ;
     subwfb    T1H,f     ;
     nop
Since it is the last step is 16-bit math, whether you save in w or f is up to you.

John
 
Top