Howdy, Stranger!

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

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

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.