#概要
wslでubuntuやってみた。
#gccをインストール
sudo apt install build-essential
#サンプルコード
gcc -no-pie fizzbuzz.S
.code32
.text
.global main
main:
mov $1, %esi
loop:
mov %esi, %eax
mov $15, %ebx
div %bl
cmp $0, %ah
jz loop15
mov %esi, %eax
mov $5, %ebx
div %bl
cmp $0, %ah
jz loop5
mov %esi, %eax
mov $3, %ebx
div %bl
cmp $0, %ah
jz loop3
mov $fmt, %edi
loop2:
mov $0, %eax
push %esi
call printf
pop %esi
loop1:
add $1, %esi
cmp $101, %esi
jnz loop
ret
loop15:
mov $fizzbuzz, %edi
jmp loop2
loop5:
mov $buzz, %edi
jmp loop2
loop3:
mov $fizz, %edi
jmp loop2
.data
fmt:
.asciz "%d "
num:
.asciz "%i "
fizz:
.asciz "Fizz "
buzz:
.asciz "Buzz "
fizzbuzz:
.asciz "FizzBuzz "
以上。