HELP WITH SOME Nbit MATH


Results 1 to 11 of 11

Threaded View

  1. #2
    Join Date
    Sep 2009
    Posts
    755


    Did you find this post helpful? Yes | No

    Default Re: HELP WITH SOME Nbit MATH

    Look at this:
    Code:
    MATH_CMP  macro Zin, Xin    ; Compare Pvars - result in M_EQ and M_GTE bits
        MOVE?PP  Zin, REG_Z          ; Z <=> X -> STATUS(C,Z)
        MOVE?PP  Xin, REG_X
        CLRFSR                       ; clear FSR first
        L?CALL   M_CMP
        MOVE?TT  STATUS,Z, _M_EQ     ; STATUS,Z set if Z == X
        MOVE?TT  STATUS,C, _M_GTE    ; STATUS,C set if Z => X;
      endm
    If I understand Darrel's code then:
    • If Z and X are equal you have set M_EQ and M_GTE
    • If Z is greater than X, bit M_GTE is set, bit M_EQ is 0
    • If Z is less than X, M_GTE and M_EQ are 0
    EDIT:
    PBP code should look like this:
    IF M_EQ=1 AND M_GTE=1 THEN
    'Z = X
    ELSEIF M_EQ=0 AND M_GTE=1 THEN
    'Z > X
    ELSE 'M_EQ=0 AND M_GTE=0
    'Z < X
    ENDIF
    Last edited by pedja089; - 23rd March 2016 at 16:00.

Similar Threads

  1. some help with math
    By longpole001 in forum mel PIC BASIC Pro
    Replies: 64
    Last Post: - 16th October 2015, 02:03
  2. Help with the math
    By Ramius in forum FAQ - Frequently Asked Questions
    Replies: 3
    Last Post: - 5th September 2014, 07:15
  3. Math help please...
    By Ioannis in forum General
    Replies: 2
    Last Post: - 20th June 2008, 10:18
  4. PBPL Math...new math takes more cycles...Always?
    By skimask in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 10th February 2008, 10:22
  5. math help
    By houa in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 30th January 2006, 16:58

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts