MPASM Macro : cfLES (Compare File Less Than File)

 

 

Introduction

Compares 2 file registers and determines if file 1 is less than file 2. If less 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      *
;              less than file 2.  If less than then jump to the passed  *
;              address.                                                 *
;************************************************************************
; Parameters: arg1 File register 1                                      *
;             arg2 File register 2                                      *
;             addr Jump to address if files equal                       *
;************************************************************************
cfLES   macro  arg1, arg2, addr   ; Compare File Equal    
        movf   arg2, W            ; WREG = arg2   
        subwf  arg1, W            ; WREG = WREG - arg1   
        btfss  STATUS, C          ; C = 0?   
        goto   addr               ; GOTO addr   
        endm 

 

Code Example

 

cfLES Assembly Code Example
(January 31, 2012)
Download: downloadDownload
Summary: cfLES macro example program. Compares 2 file registers and determines if file 1 is less than file 2. If less than then jump to the passed address.
Categories: cfLES

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>