程式語言 - Wine - Assembly (x86) - Hello, world!



參考資訊:
http://www.winprog.org/tutorial/start.html
https://learn.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-messagebox

經典的Hello, world!程式框架總是能夠讓人細心品味一款程式語言的美好,司徒就使用一個簡單的Message對話盒來展現Hello, world!框架

main.S

    .intel_syntax noprefix
    .include "/opt/wadk/wine/include/windows.inc" 
  
    .data
szCaption: .asciz ""
szContent: .asciz "Hello, world!"
  
    .text
WinMain:
    push ebp
    mov ebp, esp
  
    push MB_OK
    push offset szCaption
    push offset szContent
    push NULL
    call MessageBox
  
    push 0
    call ExitProcess
 
    xor eax, eax
    leave
    ret

編譯、執行

$ winegcc-development -m32 main.S -o main.exe
$ myx86 main.exe.so