# # File: array1_mod.s # Author: William T Krieger, Oct 2003 # # My modification of the array1 test case. # Demonstrates the definition and use of an array as a global variable. .data # data section: global vars x: # int x[3] = { 7, 14, 21}; .long 7 .long 14 .long 21 .text FMT0: .ascii "The 1st element is %d\12\0" FMT1: .ascii "The 2nd element is now %d\12\0" # # Function: _main() # void _main() # Demonstrates using a global array of 3 ints .globl _main _main: pushl %ebp # enter _main() movl %esp, %ebp movl x,%eax # call printf( fmt0, x[0]) pushl %eax pushl $FMT0 call _printf addl $8,%esp movl $100,x+4 # x[1] = 100 movl x+4,%eax # call printf( fmt1, x[1] pushl %eax pushl $FMT1 call _printf addl $8,%esp movl %ebp, %esp # exit _main() pop %ebp ret