Question: how can I write the assembly language to count on total number of characters of given string in assembly language?(relate MSP430) #include msp430.h ORG 0FF00h
how can I write the assembly language to count on total number of characters of given string in assembly language?(relate MSP430)
#include "msp430.h"
ORG 0FF00h
mystr DB "Welcome to Aeroclub Programming @JLC215!"
NAME main
PUBLIC main
ORG 0FFFEh
DC16 init
RSEG CSTACK
RSEG CODE
init: MOV #SFE(CSTACK), SP
main: NOP
MOV.W #WDTPW+WDTHOLD, &WDTCTL
BIS.B #0FFh, &P1DIR
BIS.B #0FFh, &P2DIR
MOV #mystr, R5
CLR.B R6
CLR.B R7 store total character
gonext: MOV.B @R5+, R6
CMP #0, R6
JEQ lend
INC R7
CMP.B #'a', R6
CMP.B #'{', R6
JMP gonext
lend:
MOV.B R7, &P2OUT
BIS.W #LPM4, SR
NOP
END
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
