GAS LISTING add2.s page 1 1 .file "add2.s" 2 .version "01.01" 3 gcc2_compiled.: 4 .globl buff 5 .data 6 .align 32 7 .type buff,@object 8 .size buff,80 9 buff: 10 0000 35 .ascii "5" 11 0001 20706C75 .ascii " plus " 11 7320 12 buff2: 13 0007 34 .ascii "4" 14 0008 20657175 .ascii " equals " 14 616C7320 15 buff3: 16 0010 39 .ascii "9" 17 0011 0A00 .string "\n" 18 0013 00000000 .zero 62 18 00000000 18 00000000 18 00000000 18 00000000 19 .section .rodata 20 .text 21 .align 4 22 .globl main 23 .type main,@function 24 main: 25 0000 55 pushl %ebp # Save the old frame pointer 26 0001 89E5 movl %esp, %ebp # Start a new fram here 27 0003 6A12 pushl $18 # Setup buffer size 28 0005 68000000 pushl $buff # buffer start address and 28 00 29 000a 6A01 pushl $1 # file descriptor for standard out 30 000c E8FCFFFF call write # and use low-level write service 30 FF 31 0011 83C40C addl $12, %esp # Reset stack pointer 32 0014 C6050000 movb $'1', buff # Put an ASCII 1 in the buffer 32 000031 33 001b 832D0000 sub $'0', buff # and make it binary 33 000030 34 0022 C6050700 movb $50, buff2 # Put an ASCII 2 in the buffer 34 000032 35 0029 80050700 addb $-48, buff2 # and make it binary 35 0000D0 36 0030 31C0 xor %eax, %eax # Clear all 32 bits of the acumulator 37 0032 02050000 addb buff, %eax # Add the first binary number 37 0000 38 0038 02050700 addb buff2, %eax # Add the second binary number 38 0000 39 003e 80050000 addb $'0', buff # Make first number ASCII 39 000030 40 0045 80050700 addb $'0', buff2 # Make second number ASCII 40 000030 41 004c 0430 addb $'0', %eax # Make the result ASCII 42 004e 88051000 movb %eax, buff3 # Save result in the buffer 42 0000 43 0054 6A12 pushl $18 # Do 44 0056 68000000 pushl $buff # write 44 00 45 005b 6A01 pushl $1 # system 46 005d E8FCFFFF call write # service 46 FF 47 0062 83C40C addl $12,%esp # and reset stack pointer 48 .L1: 49 0065 C9 leave 50 0066 C3 ret 51 .Lfe1: 52 .size main,.Lfe1-main 53 .ident "GCC: (GNU) egcs-2.91.66 19990314/Linux (egcs-1.1.2 release)" DEFINED SYMBOLS *ABS*:00000000 add2.s ab.s:3 .text:00000000 gcc2_compiled. ab.s:9 .data:00000000 buff ab.s:12 .data:00000007 buff2 ab.s:15 .data:00000010 buff3 ab.s:24 .text:00000000 main UNDEFINED SYMBOLS write