如何根据LC3中的用户输入来计算字符

时间:2019-04-11 08:34:11

标签: lc3

我需要有人帮助我编码此问题 我想知道如何根据用户输入来计算字符

我已经尝试过这样做,但是在9位数字之后,它给出了另一个ascii值

.orig x3000

lea r0, HelloString

puts

Lea r0, EnterString

Lea r4, yourText

puts

loop getc

add r1, r0, -10

brz outside

out

str r0, r4, 0

add r4, r4, 1

brnzp loop

ld r2, minusEnter

outside

Lea r0, anotherString

puts

Lea r0, yourText

puts


Lea r0, NumberCharacter

below

puts


ld r0, character 

add r0, r0, r2

out

halt

yourText .blkw 100


HelloString .stringz "\nStudent Name, ID number: Darryl, 17738468 "

EnterString .stringz "\nPlease enter a text: "

minusEnter .fill x-A

anotherString .stringz "\nThe text you typed is: "

NumberCharacter .stringz "\nTotally, it has "

NumberCharacters .stringz "characters including spaces "

character .fill x30


.end

0 个答案:

没有答案
相关问题