Luis Fernando wrote: > > Hi all, > I'm needing a help. > I'm looking for a way how get a comparisons with16 bit variables, for > exemple: > > A = B, A < B or A > B > > Somebody could send me any codes? > > Best regards > > Anbar Try this. I wrote this a while ago... Nino. ;******************************************************************* ; A not too optimised 16 bit compare routine for 16 absolute values, ; ie 0 -> 65536. ; Compare WORD to COMP (a word value). ; If WORD = COMP return with 00 ; If WORD > COMP return with 01 ; If WORD < COMP return with 80 ;******************************************************************* hword equ 0x10 ; storage for high byte of WORD lword equ hword+1 ; storage for low byte of WORD hcomp equ 0x12 ; storage for high byte of COMP lcomp equ hcomp+1 ; storage for low byte of COMP COMP movfw hcomp ; get high byte of comp value subwf hword ; subtract values btfsc status,z ; first check if result is 0 goto COMPL ; if zero compare low bytes btfsc status,c ; else test carry bit retlw 0x01 ; if WORD > COMP, return with 01h retlw 0x80 ; if WORD < COMP, return with 80h COMPL movfw lcomp ; get low byte of comp value subwf lbyte ; subtract values btfsc status,z ; first check if result is 0 retlw 0x00 ; if result is 0, return with 00 btfsc status,c ; if c set then WORD > COMP retlw 0x01 ; if WORD > COMP, return with 01h retlw 0x80 ; if WORD < COMP, return with 80h end Content-type: text/x-vcard; name=Nino.Benci.vcf; charset=us-ascii Content-description: Card for Antonio L Benci Content-disposition: attachment; filename=Nino.Benci.vcf Content-transfer-encoding: 7BIT Attachment converted: creation:Nino.Benci.vcf (TEXT/CSOm) (00015EC2)