LoginSignup
0
0

More than 3 years have passed since last update.

paizaでアセンブラ その9

Posted at

概要

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

練習問題

ebpレジスタの値を表示せよ。

サンプルコード

.code32
.text
.global main

main:
    movl    $buf, %ecx
    mov     %ebp, %eax
    rol     %eax
    rol     %eax
    rol     %eax
    rol     %eax
    call    puth
    mov     %ebp, %eax
    rol     %eax
    rol     %eax
    rol     %eax
    rol     %eax
    rol     %eax
    rol     %eax
    rol     %eax
    rol     %eax
    call    puth
    mov     %ebp, %eax
    rol     %eax
    rol     %eax
    rol     %eax
    rol     %eax
    rol     %eax
    rol     %eax
    rol     %eax
    rol     %eax
    rol     %eax
    rol     %eax
    rol     %eax
    rol     %eax
    call    puth
    mov     %ebp, %eax
    rol     %eax
    rol     %eax
    rol     %eax
    rol     %eax
    rol     %eax
    rol     %eax
    rol     %eax
    rol     %eax
    rol     %eax
    rol     %eax
    rol     %eax
    rol     %eax
    rol     %eax
    rol     %eax
    rol     %eax
    rol     %eax
    call    puth  
    mov     %ebp, %eax
    rol     %eax
    rol     %eax
    rol     %eax
    rol     %eax
    rol     %eax
    rol     %eax
    rol     %eax
    rol     %eax
    rol     %eax
    rol     %eax
    rol     %eax
    rol     %eax
    rol     %eax
    rol     %eax
    rol     %eax
    rol     %eax
    rol     %eax
    rol     %eax
    rol     %eax
    rol     %eax
    call    puth 
    mov     %ebp, %eax
    rol     %eax
    rol     %eax
    rol     %eax
    rol     %eax
    rol     %eax
    rol     %eax
    rol     %eax
    rol     %eax
    rol     %eax
    rol     %eax
    rol     %eax
    rol     %eax
    rol     %eax
    rol     %eax
    rol     %eax
    rol     %eax
    rol     %eax
    rol     %eax
    rol     %eax
    rol     %eax
    rol     %eax
    rol     %eax
    rol     %eax
    rol     %eax
    call    puth
    mov     %ebp, %eax
    rol     %eax
    rol     %eax
    rol     %eax
    rol     %eax
    rol     %eax
    rol     %eax
    rol     %eax
    rol     %eax
    rol     %eax
    rol     %eax
    rol     %eax
    rol     %eax
    rol     %eax
    rol     %eax
    rol     %eax
    rol     %eax
    rol     %eax
    rol     %eax
    rol     %eax
    rol     %eax
    rol     %eax
    rol     %eax
    rol     %eax
    rol     %eax
    rol     %eax
    rol     %eax
    rol     %eax
    rol     %eax
    call    puth
    mov     %ebp, %eax
    call    puth
    ret

puth:
    and     $0x0f, %eax
    add     %eax, %ecx
    movl    $4, %eax
    movl    $1, %ebx
    movl    $1, %edx
    int     $0x80
    movl    $buf, %ecx
    ret

.data
buf:
    .ascii  "0123456789ABCDEF"

成果物

以上。

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