## ============================================================ ## detecta.s ## ============================================================ ## ============================================================ .section ".rodata" ## ============================================================ cMessage: .asciz "The char is A.\n" ## ============================================================ .section ".text" ## ============================================================ ## ------------------------------------------------------------ ## int main(int argc, char *argv[]) ## ## Read a char from stdin. Write a message to stdout if it is ## the character 'A'. ## ------------------------------------------------------------ .globl main .type main,@function main: pushl %ebp movl %esp, %ebp ## iChar = getchar(); call getchar ## if (iChar != 'A') goto skip; cmpl $'A', %eax jne skip ## printf("The char is A.\n"); pushl $cMessage call printf addl $4, %esp skip: ## return 0; movl $0, %eax movl %ebp, %esp popl %ebp ret