I'm trying to make a assembly program to add two numbers, but when I type in the numbers it includes the \n at the end of the script meaning that when I do
add R3,R2,R1
it includes \n as a number when I run strace it it shows that the program is printing two null terminators \0\0 picture of the program running and the program running with strace
the code is as follows
.data
keyin: .space 20
num1: .space 2
num2: .space 2
num3: .space 3
addmsg1: .ascii "enter a number: "
addmsg2: .ascii "enter another number: "
addmsg3: .ascii "the sum of those numbers are: "
addcode: .ascii "add\n"
.text
.global _start:
_start:
ldr R1,=addmsg1
mov R2,#16
bl print
ldr R1,=num1
mov R2,#2
bl input
ldr R1,=addmsg2
mov R2,#22
bl print
ldr R1,=num2
mov R2,#2
bl input
ldr R1,=num1
ldr R1,[R1]
ldr R2,=num2
Ldr R2,[R2]
add R3,R2,R1
ldr R2,=num3
str R3,[R2]
ldr R1,=addmsg3
mov R2,#30
bl print
ldr R1,=num3
mov R2,#2
bl print
print:
mov R7,#4
mov R0,#1
SWI 0
bx lr
input:
ldr R1,=keyin
mov R7,#3
mov R0,#0
SWI 0
bx lr
I don't want to keep the \n when I type in the number but I have to accept it as part of the input otherwise if I typed 3 for the first number the \n would go into the second number as the input
I want to shorten the string to just one byte so that only the numbers are present
im uing rpi 4
arm V8-a raspbian buster (for the syscalls)
any help would be welcome if you need more info just ask