Shop OBEX P1 Docs P2 Docs Learn Events
Operation on the working register — Parallax Forums

Operation on the working register

Jim KuenemanJim Kueneman Posts: 9
edited 2007-11-05 02:55 in General Discussion
Am I missing something or is it not possible to do operations just on the working register? For instance I want the two's compliment of what I have in the register:

    not  w
    inc  w
    retiw



It seems I have to use a scratch register to do this:

    mov    SCRATCH, w
    not    SCRATCH
    inc    SCRATCH
    mov    w, SCRATCH
    retiw



Am I missing something?

Thanks,
Jim

Comments

  • Peter VerkaikPeter Verkaik Posts: 3,956
    edited 2007-11-05 02:44
    You can set a bit in the OPTION register, to make W available at address $01.
    You can then use WREG to do file operations on W. While W is available at $01,
    RTCC is not, and vice versa.

    regards peter
  • Jim KuenemanJim Kueneman Posts: 9
    edited 2007-11-05 02:55
    Ah, interesting. Thanks.

    Jim
Sign In or Register to comment.