NASM - The Netwide Assembler

NASM Forum => Example Code => Topic started by: Structure on January 10, 2020, 06:12:15 PM

Title: IFF macro...
Post by: Structure on January 10, 2020, 06:12:15 PM
Code: [Select]

strcmp:
 .cmploop:
  mov al, [si]
  mov bl, [di]
  cmp al, bl
  jne .exitstrcmp
  cmp al, 0
  je .match
  inc di
  inc si
  jmp .cmploop
  .exitstrcmp:
    clc
    jmp retback
  ret
  .match:
    stc
    jmp retback
  ret
  retback:
ret

%macro iff 3
  mov si, %1
  mov di, %2
  call strcmp
  jc %3
%endmacro

i.e:
Code: [Select]
  iff string1, string2, gotoLabel
Title: Re: IFF macro...
Post by: debs3759 on January 10, 2020, 10:36:34 PM
Sadly, that only covers iff a==b.
iff covering a complex comparison would be much more useful :)