;;; File: lab6a_1.asm .ORIG x3000 ReadString LEA R0, Prompt PUTS ; Display a prompt requesting input LD R1, InBuffLen ; Set R1 to length of input buffer LEA R2, InBuffPtr ; Set R2 to address of input buffer in memory BRnzp ReadCore ; Goto the core input code Prompt .STRINGZ "Enter a number: " ; The prompt string InBuffLen .FILL 10 ; The length of the input buffer InBuffPtr .BLKW 10 ; The memory reserved for the input buffer ;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;; Insert your code here!!!!!!!!!!!!!!! ;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ProcessInput LEA R2, InBuffPtr ; Put address of string in R2 BRnzp OutputResult ; Output the result OutputResult LEA R0, StartOfLineStr PUTS ; Output the preceding text before result ADD R0, R2, #0 ; Copy the output buffer to R0 PUTS ; Output the result LEA R0, EndOfLineStr PUTS ; Output the a newline after the result BRnzp ReadString ; Continue reading new numbers indefinitely StartOfLineStr .STRINGZ "Answer: \"" ; The preceding text before result EndOfLineStr .STRINGZ "\"\n" ; A newline .END