LoginSignup
0
0

More than 3 years have passed since last update.

概要

paizaでアセンブラ、やってみた。
練習問題やってみた。

練習問題

xorの真理値表を作成せよ。

サンプルコード

.code32
.text
.global main

main:
    mov     $sin, %edi
    mov     $0, %eax
    call    printf
    mov     $cr, %edi
    call    puts

    mov     $0, %esi
    mov     $fmt, %edi
    mov     $0, %eax
    call    printf
    mov     $0, %esi
    mov     $fmt, %edi
    mov     $0, %eax
    call    printf
    mov     $0, %eax
    mov     $0, %ebx
    xor     %ebx, %eax
    mov     %eax, %esi
    mov     $fmt, %edi
    mov     $0, %eax
    call    printf
    mov     $cr, %edi
    call    puts

    mov     $1, %esi
    mov     $fmt, %edi
    mov     $0, %eax
    call    printf
    mov     $0, %esi
    mov     $fmt, %edi
    mov     $0, %eax
    call    printf
    mov     $1, %eax
    mov     $0, %ebx
    xor     %ebx, %eax
    mov     %eax, %esi
    mov     $fmt, %edi
    mov     $0, %eax
    call    printf
    mov     $cr, %edi
    call    puts

    mov     $0, %esi
    mov     $fmt, %edi
    mov     $0, %eax
    call    printf
    mov     $1, %esi
    mov     $fmt, %edi
    mov     $0, %eax
    call    printf
    mov     $0, %eax
    mov     $1, %ebx
    xor     %ebx, %eax
    mov     %eax, %esi
    mov     $fmt, %edi
    mov     $0, %eax
    call    printf
    mov     $cr, %edi
    call    puts

    mov     $1, %esi
    mov     $fmt, %edi
    mov     $0, %eax
    call    printf
    mov     $1, %esi
    mov     $fmt, %edi
    mov     $0, %eax
    call    printf
    mov     $1, %eax
    mov     $1, %ebx
    xor     %ebx, %eax
    mov     %eax, %esi
    mov     $fmt, %edi
    mov     $0, %eax
    call    printf
    mov     $cr, %edi
    call    puts

    ret

.data
sin:
    .asciz  "A B X"
fmt:
    .asciz  "%d "
cr:
    .byte   13
    .byte   0   



成果物

以上。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0