AndreLopes20 0 Posted May 30, 2016 Report Share Posted May 30, 2016 Boas , estou a tentar fazer um programa em assembly onde é pedido para fazer uma rotina que tendo como parâmetro de entrada oendereço de uma stringC, devolva o somatório BCD (dois dígitos por byte) dos elementosque constituem a string, também assumidos como BCD. Comecei por fazer o seguinte: .data message1 : .asciiz "Introduza a string pretendida: \n" message2 : .asciiz "O somatorio da sua string é" userinput : .space 100 .text main: li $v0,4 la $a0, message1 syscall #Getting user's input as text li $v0,8 la $a0,userinput li $a1,100 syscall #Display string li $v0,4 la $a0,userinput syscall # jal somatorioelementos #Tell the system this is the end of main li $v0,10 syscall somatorioelementos: #Display somatorio li $v0,4 la $a0,message2 syscall #Tell the system this is the end of main li $v0,10 syscall Alguem me pode ajudar ? Estou no caminho certo ? Nao faço a minima como é que vou fazer a parte do somatorio . Link to post Share on other sites
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now