ARM AS Assembler read() running before printf() but printf() is previous statement [duplicate]

I'm having a strange thing happen to me. I'm calling printf() THEN read() in my program, but the read() happens first, and the printf() afterward? I've cut this down to the smallest possible code which shows the problem. If you type something in, it does pick everything up correctly.

.data

.balign 4
message1:       .asciz "Please type a string: "

.balign 4
input_string:
    .asciz ""
    .zero 80

return: .word 0

.text
.global main

main:
    push {lr}

    ldr r0, =message1
    bl printf

    ldr r1, =input_string
    mov r3, #80
    mov r0, #0

    bl read
    mov r0, r1
    bl printf

    pop {lr}
    bx lr

.end


.global printf
.global read


from Recent Questions - Stack Overflow https://ift.tt/2S2aHU3
https://ift.tt/eA8V8J

Comments

Popular posts from this blog

Today Walkin 14th-Sept

Hibernate Search - Elasticsearch with JSON manipulation

Spring Elasticsearch Operations