I have to write a program that will calculate the average of several numbers in/with Pep/8.
My main problem now is he didn't let us use DECI
and we have to use CHARI
but I can't make it go from number to number as the user can input up to 40 characters separated by spaces on that line before it gives off an error. I need to go from number to number and add them then divide by how many there are. Numbers are from -53 to 48. Also, we can't accept --40 or stuff like that.
How can I do that?
This is what I have until now for this part.
STRO msgb,d
STRO msg,d
LDX 0,i
CHARI number,x
LDA 0,i
LDBYTEA number,x
STA total,d
ADDX 1,i
LDBYTEA number,x
ADDA number,x
STA total,d
DECO total,d
STOP
caract: .BYTE 0
msgb: .ASCII "Welcome"
.BYTE 0
msg: .ASCII "\nPlease enter numbers here: "
.BYTE 0
nombre: .WORD 0
total: .WORD 0
.END