elif.asm 744 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. ;Testname=unoptimized; Arguments=-O0 -fobj -oelif.obj; Files=stdout stderr elif.obj
  2. ;Testname=optimized; Arguments=-Ox -fobj -oelif.obj; Files=stdout stderr elif.obj
  3. %macro DosPrintMsg 1+
  4. %ifnid %1
  5. section .data
  6. %%str_to_print:db %1
  7. section .text
  8. mov dx,%%str_to_print
  9. mov ah,9
  10. int 0x21
  11. %else
  12. mov dx,(%1)
  13. mov ah,9
  14. int 0x21
  15. %endif
  16. %endmacro
  17. %macro DosExit 1
  18. %if (%1) == 0
  19. ;use short-form return 0 exit
  20. int 0x20
  21. %elif ((%1) < 256) && ((%1) > 0)
  22. mov ax,0x4C00 | (%1)
  23. int 0x21
  24. %else
  25. %error Invalid return value
  26. %endif
  27. %endmacro
  28. org 0x100
  29. DosPrintMsg predefined_str
  30. DosPrintMsg "Using string with macro-defined label",10,0
  31. DosExit 0
  32. DosExit 1
  33. DosExit 256
  34. section .data
  35. predefined_str:db "Using string with predefined label",10,0