# # File: scanf1_mod.s # Author: William T Krieger, Oct 2003 # # My modification of the scanf test case, demonstrating use of scanf() .data # data section: glocal vars x: .long 0 # x = 0 y: .long 0 # y = 0 .text FMT0: .ascii "Enter 2 integer values:\0" FMT1: .ascii "%d%d\0" FMT2: .ascii "Two values are: %d, %d\12\0" .align 4 # # Function: _main() # void _main() # Demonstrates how to call scanf(). .globl _main _main: pushl %ebp # enter _main() movl %esp, %ebp pushl $FMT0 # call printf( fmt0) call _printf addl $4,%esp pushl $y # call scanf( fmt1, &x, &y) pushl $x pushl $FMT1 call _scanf addl $12,%esp pushl y # call printf( fmt2, x, y) pushl x pushl $FMT2 call _printf addl $12,%esp movl %ebp, %esp # exit _main() pop %ebp ret