Changeset 24


Ignore:
Timestamp:
Mar 20, 2013, 2:09:11 PM (11 years ago)
Author:
Mattia Monga
Message:

Esercizi lab 3

Location:
trunk
Files:
2 added
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/hello.s

    r7 r24  
    1 .sect .text; .sect .rom; .sect .data; .sect .bss
    2 .extern _main
    3 .sect .text
    4 _main:
    5 push ebp
    6 mov ebp,esp
    7 push esi
    8 xor esi,esi
    9 I1_6:
    10 cmp esi,10
    11 jge I1_3
    12 mov edx,esi
    13 inc edx
    14 push edx
    15 push I_1
    16 call _printf
    17 pop ecx
    18 pop ecx
    19 push 1
    20 call _sleep
    21 pop ecx
    22 inc esi
    23 jmp I1_6
    24 I1_3:
    25 push 3
    26 call _exit
    27 pop ecx
    28 pop esi
    29 leave
    30 ret
    31 .sect .rom
    32 I_1:
    33 .data4  1819043144
    34 .data4  1870078063
    35 .data4  560229490
    36 .data4  1680156704
    37 .data4  2601
    38 .sect .text
     1        .file   "hello.c"
     2        .section        .rodata
     3.LC0:
     4        .string "Hello world! (%d)\n"
     5        .text
     6        .globl  main
     7        .type   main, @function
     8main:
     9.LFB0:
     10        .cfi_startproc
     11        pushl   %ebp
     12        .cfi_def_cfa_offset 8
     13        .cfi_offset 5, -8
     14        movl    %esp, %ebp
     15        .cfi_def_cfa_register 5
     16        andl    $-16, %esp
     17        subl    $32, %esp
     18        movl    $0, 28(%esp)
     19        jmp     .L2
     20.L3:
     21        movl    28(%esp), %eax
     22        addl    $1, %eax
     23        movl    %eax, 4(%esp)
     24        movl    $.LC0, (%esp)
     25        call    printf
     26        movl    $1, (%esp)
     27        call    sleep
     28        addl    $1, 28(%esp)
     29.L2:
     30        cmpl    $9, 28(%esp)
     31        jle     .L3
     32        movl    $0, (%esp)
     33        call    exit
     34        .cfi_endproc
     35.LFE0:
     36        .size   main, .-main
     37        .ident  "GCC: (Debian 4.7.2-5) 4.7.2"
     38        .section        .note.GNU-stack,"",@progbits
Note: See TracChangeset for help on using the changeset viewer.