fork download
  1. ;
  2. ; nasm/nasm -fwin32 hoge.asm
  3. ; alink/alink hoge.obj win32.lib -L /alink/lib -m -oPE -entry _start
  4. ;
  5. bits 32
  6. extern MessageBoxA
  7. extern ExitProcess
  8.  
  9. section .text
  10. global _start
  11. _start:
  12. push ebp
  13. mov ebp, esp
  14.  
  15. mov eax, ds
  16. mov es, eax
  17. mov edi, msg
  18. mov eax, 000000deH
  19. push eax
  20. call bin2hex
  21. mov [edi], ah
  22. inc edi
  23. mov [edi], al
  24.  
  25. push dword 30H ; MB_ICONEXCLAMATION
  26. push dword title
  27. push dword msg
  28. push dword 0
  29. call MessageBoxA
  30. push dword 0
  31. call ExitProcess
  32. mov eax, 0
  33.  
  34. mov esp, ebp
  35. pop ebp
  36. ret
  37.  
  38. b2a:
  39. push ebp
  40. mov ebp, esp
  41.  
  42. mov eax, [esp + 8]
  43. and al, 0FH
  44. or al, 30H
  45. cmp al, 39H
  46. jle skip
  47. add al, 7
  48. skip:
  49.  
  50. mov esp, ebp
  51. pop ebp
  52. ret
  53.  
  54. bin2hex:
  55. push ebp
  56. mov ebp, esp
  57.  
  58. mov eax, [esp + 8]
  59. mov cl, 4
  60. shr al, cl
  61. push eax
  62. call b2a
  63. xor edx, edx
  64. mov dh, al
  65. mov eax, [esp + 12] ; shifted because first push eax
  66. push eax
  67. call b2a
  68. mov ah, dh
  69.  
  70. mov esp, ebp
  71. pop ebp
  72. ret
  73.  
  74. section .data
  75. title: db 'win32api', 0
  76. msg: db '00', 0
  77.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.o: In function `_start':
prog.asm:(.text+0x2b): undefined reference to `MessageBoxA'
prog.asm:(.text+0x32): undefined reference to `ExitProcess'
stdout
Standard output is empty