|
From: <cg...@wo...> - 2003-03-09 11:03:35
|
Well, I'll need to work it out from zero myself (but after learning=20 NASM). I want only one question I cannot solve, and if it gets assembled=20 without errors I don't know if it because it is done right or not, in=20 fact I get run-time errors. It's about variable declaration and initialization: The current code which is assembled but doesn't run is: .data mensaje1: .ascii "Introduzca un n=FAmero\n\0" mensaje2: .ascii "El doble es: \0" string: .ascii "%d\n\0" numer: .long 200 .bss .comm entero, 4 .text .global _asm_main .extern _printf .extern scanf _asm_main: enter $0, $0 pusha movl (mensaje1), %eax push %eax call _printf addl $12, %esp movl numer, %eax push %eax push (string) call _printf addl $16, %esp push (entero) push (string) call _scanf movl %eax, (entero) addl $16, %esp movl entero, %eax addl %eax, %eax movl %eax, %ebx movl (mensaje2), %eax push %eax call _printf addl $12, %esp movl %ebx, %eax push %eax push (string) call _printf addl $16, %ebp popa movl $0, %eax leave ret Can someone make these pieces of code be correctly written? If so many=20 thanks, if not, thanks anyway. Have a nice day, all of you. |