MPASM Macro : cfEQU (Compare Files Equal)

 

 

Introduction

Compares 2 file registers 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: cfEQU                                            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   File register 2                                   *
;              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

 

cfEQU Assembly Code Example
(January 12, 2012)
Download: downloadDownload
Summary: cfEQU macro example program. Compares 2 file registers and determine if equal. If equal then jump to the passed address.
Categories: cfEQU

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>