Home > cfGRT, MPASM Macro > MPASM Macro : cfGRT (Compare File Greater Than File)

MPASM Macro : cfGRT (Compare File Greater Than File)

 

Introduction

Compares 2 file registers and determines if file 1 is greater than file 2. If greater than then jump to the passed address.

 

Macro Flowchart

 

 

Macro Code

;************************************************************************
; Macro: cfGRT                                            Version: 1.00 *
; Author: Garrett Blanton                                               *
;************************************************************************
; Description: Compare 2 file registers and determine if file 1 is      *
;              greater than file 2.  If greater than then jump to the   *
;              passed address.                                          *
;************************************************************************
; Parameters:  arg1 File register 1                                     *
;              arg2 File register 2                                     *
;              addr Jump to address if files equal                      *
;************************************************************************
cfGRT   macro   arg1, arg2, addr   ; Compare File Equal    
        movf    arg1, W            ; WREG = arg1   
        subwf   arg2, W            ; WREG = WREG - arg2   
        btfss   STATUS, C          ; C = 0?   
        goto    addr               ; GOTO addr   
        endm  

 

Code Example

 

cfGRT Assembly Code Example
(January 24, 2012)
Download: downloadDownload
Summary: cfGRT macro example program. Compares 2 file registers and determines if file 1 is greater than file 2. If greater than then jump to the passed address.
Categories: cfGRT
Categories: cfGRT, MPASM Macro Tags:
  1. No comments yet.
  1. No trackbacks yet.