simple calculator for arm assembly? - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

simple calculator for arm assembly?

I need a simple calculator, that will simply do addition from input numbers and the expression and show the answer, all done in a console window like UART#1 but I am at a complete loss. I missed a lot of lectures due to personal issues and cannot get the lecture notes till end of term.

I was given this code to start with if it gives some idea.


AREA Expression, CODE, READONLY
IMPORT main
IMPORT getkey
IMPORT sendchar
EXPORT start

start

;
; Read a sequence of ASCII character codes from UART #1 until
; the user enters a "+" character
;
while1
BL getkey ; while (read next ASCII character c
BL sendchar ; display ("echo") character c
CMP R0, #'+' ; continue while c not "+")
BEQ endwh1 ; {


;
; You can process the ASCII charcater code stored in R0 here!!
;

B while1 ; } branch back to read next character
endwh1

;
; The rest of your program (e.g. reading the second sequence of digits)
; goes here!!
;

stop B stop

END



Sign In or Register to comment.