MPASM Macro : ckEQU (Compare File / Constant Equal)

 

 

Introduction

Compares a file registers to a constant value and determine if equal. If equal then jump to the passed address.

 

 

 

Macro Flowchart

 

 

Macro Code

 

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
;************************************************************************
; Macro: ckEQU                                            Version: 1.00 *
; Author: Garrett Blanton                                               *
;************************************************************************
; Description: Compares 2 file registers and determine if they are      *
;              equal.  If equal then jump to the passed address.        *
;************************************************************************
; Parameters: arg1   File register 1                                    *
;             arg2   Constant value                                     *
;             addr   Jump to address if files equal                     *
;************************************************************************
cfEQU   macro   arg1, arg2, addr   ; Compare File Equal
        movf    arg1, W            ; WREG = arg1
        subwf   arg2, W            ; WREG = WREG - arg2
        btfsc   STATUS, Z          ; Z = 0?
        goto    addr               ; GOTO addr
        endm

 

Code Example

 

ckEQU Assembly Code Example
(January 13, 2012)
Download: downloadDownload
Summary: ckEQU macro example program. Compares a file registers to a constant value and determine if equal. If equal then jump to the passed address.
Categories: ckEQU

One Comment

  • Cecelia says:

    Hello there, You’ve done an incredible job. I’ll definitely digg it and personally suggest to
    my friends. I’m confident theey wikl be benefited
    from this website.

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>