Jacob Clark
Jacob Clark

Reputation: 3447

ARM11 bad instruction `num resb 5' Assembly

Attempting to compile the following in order to read a 5 byte char from stdin:

.bss
    num resb 5

.text
.global _start
_start:
        mov r0, $1
        mov r1, num
        mov r2, $5
        mov r7, #3
        swi $0

Via the following

as -o readstdin.o readstdin.s

But I get the assembly error:

readstdin.s: Assembler messages:
readstdin.s:2: Error: bad instruction `num resb 5'
readstdin.s:8: Error: immediate expression requires a # prefix -- `mov r1,num'

I am running this on an ARM11 Raspberry Pi Zero.

Upvotes: -1

Views: 1107

Answers (1)

Jester
Jester

Reputation: 58762

gnu assembler does not use resb. Try .lcomm num, 5 instead. As for mov r1, num I guess you really wanted to say ldr r1, =num. You might want to consult the manual.

Upvotes: 1

Related Questions