Forums before death by AOL, social media and spammers... "We can't have nice things"
|    comp.lang.asm.x86    |    Ahh, the lost art of x86 assembly    |    4,675 messages    |
[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]
|    Message 3,091 of 4,675    |
|    aen@nospicedham.spamtrap.com to All    |
|    Easy message box    |
|    26 Nov 17 19:43:17    |
      Hi!              Hey, wouldn't ya know, there is an easy way to show a windows-like       message box in Linux:              .intel_syntax noprefix       .title "Project Euler"       .sbttl "Problem 1"       # as -o sdl.o sdl.asm       # ld -o sdl sdl.o -lX11 -lSDL2 --dynamic-linker       /lib64/ld-linux-x86-64.so.2       .altmacro       .macro ccall p0:req,p1,p2,p3,p4,p5,p6,p7,p8,p9,p10,p11       params=0       .ifnb \p11 ; push \p11 ; params=params+8 ; .endif       .ifnb \p10 ; push \p10 ; params=params+8 ; .endif       .ifnb \p9 ; push \p9 ; params=params+8 ; .endif       .ifnb \p8 ; push \p8 ; params=params+8 ; .endif       .ifnb \p7 ; push \p7 ; params=params+8 ; .endif       .ifnb \p6 ; mov r9,\p6 ; .endif       .ifnb \p5 ; mov r8,\p5 ; .endif       .ifnb \p4 ; mov rcx,\p4 ; .endif       .ifnb \p3 ; mov rdx,\p3 ; .endif       .ifnb \p2 ; mov rsi,\p2 ; .endif       .ifnb \p1 ; mov rdi,\p1 ; .endif        call \p0       .if params        add rsp,params       .endif       .endm # ccall               .data       title: .asciz "SDL Message Box:"       message: .asciz " "       format: .asciz "%d"               .text        .globl _start        .type main,@function       main: ; _start: nop              0: lea eax,[999+1]        mov rbx,0x5555555555555555 # Reciprocal for 3.        mul rbx # n/999        lea rax,[rdx+1] # n + 1        mul rdx # n(n + 1)        shr rax,1 # n(n + 1)/2        lea rdi,[rax+rax*2] # Sum multiples of 3.               lea eax,[999+1]        mov rbx,0x3333333333333333 # Reciprocal for 5.        mul rbx # n/999        lea rax,[rdx+1] # n + 1        mul rdx # n(n + 1)        shr rax,1 # n(n + 1)/2        lea rax,[rax+rax*4] # Sum multiples of 5.        add rdi,rax               lea eax,[999+1]        mov rbx,0x1111111111111111 # Reciprocal for 15.        mul rbx # n/999        lea rax,[rdx+1] # n + 1        mul rdx # n(n + 1)        shr rax,1 # n(n + 1)/2        lea rax,[rax+rax*4]        lea rax,[rax+rax*2] # Sum multiples of 15.        sub rdi,rax              ccall sprintf, |
[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]
(c) 1994, bbs@darkrealms.ca