LOOKING FOR A BETTER WAY TO WRITE THIS METHOD thanks , ASSEMBLY LANGUAGE getChar
ID: 655851 • Letter: L
Question
LOOKING FOR A BETTER WAY TO WRITE THIS METHOD thanks , ASSEMBLY LANGUAGE
getCharacters PROC
;NUBER OF CHARACTERS
mov edx,OFFSET prompt1 ;Input paragraph, to end enter '%'
call WriteString
mov number_of_words,1
mov number_of_Sent,1
mov number_of_sletters,0
mov number_of_characters,0
mov number_of_vowels,0
mov number_of_capitals,0
L1:
call ReadChar
call displayEvry
cmp AL,Sentinel ;%-to calculate
jne NOT_QUITF
mov edx,OFFSET prompt2 ;'%' Found. End of paragraph
call WriteString
jmp QUITF ;display result procedure
NOT_QUITF:
cmp AL,'A'
jne NOT_A
inc number_of_characters
NOT_A:
cmp AL,'B'
jne NOT_B
inc number_of_characters
NOT_B:
cmp AL,'C'
jne NOT_C
inc number_of_characters
NOT_C:
cmp AL,'D'
jne NOT_D
inc number_of_characters
NOT_D:
cmp AL,'E'
jne NOT_E
inc number_of_characters
NOT_E:
cmp AL,'F'
jne NOT_F
inc number_of_characters
NOT_F:
cmp AL,'G'
jne NOT_G
inc number_of_characters
NOT_G:
cmp AL,'H'
jne NOT_H
inc number_of_characters
NOT_H:
cmp AL,'I'
jne NOT_I
inc number_of_characters
NOT_I:
cmp AL,'J'
jne NOT_J
inc number_of_characters
NOT_J:
cmp AL,'K'
jne NOT_K
inc number_of_characters
NOT_K:
cmp AL,'L'
jne NOT_L
inc number_of_characters
NOT_L:
cmp AL,'M'
jne NOT_M
inc number_of_characters
NOT_M:
cmp AL,'N'
jne NOT_N
inc number_of_characters
NOT_N:
cmp AL,'O'
jne NOT_O
inc number_of_characters
NOT_O:
cmp AL,'P'
jne NOT_P
inc number_of_characters
NOT_P:
cmp AL,'Q'
jne NOT_Q
inc number_of_characters
NOT_Q:
cmp AL,'R'
jne NOT_R
inc number_of_characters
NOT_R:
cmp AL,'S'
jne NOT_S
inc number_of_characters
NOT_S:
cmp AL,'T'
jne NOT_T
inc number_of_characters
NOT_T:
cmp AL,'U'
jne NOT_U
inc number_of_characters
NOT_U:
cmp AL,'V'
jne NOT_V
inc number_of_characters
NOT_V:
cmp AL,'W'
jne NOT_W
inc number_of_characters
NOT_W:
cmp AL,'X'
jne NOT_X
inc number_of_characters
NOT_X:
cmp AL,'Y'
jne NOT_Y
inc number_of_characters
NOT_Y:
cmp AL,'Z'
jne NOT_Z
inc number_of_characters
NOT_Z:
cmp AL,'a'
jne NOT_aaa
inc number_of_characters
NOT_aaa:
cmp AL,'b'
jne NOT_bb
inc number_of_characters
NOT_bb:
cmp AL,'c'
jne NOT_cc
inc number_of_characters
NOT_cc:
cmp AL,'d'
jne NOT_dd
inc number_of_characters
NOT_dd:
cmp AL,'e'
jne NOT_eee
inc number_of_characters
NOT_eee:
cmp AL,'f'
jne NOT_ff
inc number_of_characters
NOT_ff:
cmp AL,'g'
jne NOT_gg
inc number_of_characters
NOT_gg:
cmp AL,'h'
jne NOT_hh
inc number_of_characters
NOT_hh:
cmp AL,'i'
jne NOT_iii
inc number_of_characters
NOT_iii:
cmp AL,'j'
jne NOT_jj
inc number_of_characters
NOT_jj:
cmp AL,'k'
jne NOT_kk
inc number_of_characters
NOT_kk:
cmp AL,'l'
jne NOT_ll
inc number_of_characters
NOT_ll:
cmp AL,'m'
jne NOT_mm
inc number_of_characters
NOT_mm:
cmp AL,'n'
jne NOT_nn
inc number_of_characters
NOT_nn:
cmp AL,'o'
jne NOT_ooo
inc number_of_characters
NOT_ooo:
cmp AL,'p'
jne NOT_pp
inc number_of_characters
NOT_pp:
cmp AL,'q'
jne NOT_qq
inc number_of_characters
NOT_qq:
cmp AL,'r'
jne NOT_rr
inc number_of_characters
NOT_rr:
cmp AL,'s'
jne NOT_ss
inc number_of_characters
NOT_ss:
cmp AL,'t'
jne NOT_tt
inc number_of_characters
NOT_tt:
cmp AL,'u'
jne NOT_uuu
inc number_of_characters
NOT_uuu:
cmp AL,'v'
jne NOT_vv
inc number_of_characters
NOT_vv:
cmp AL,'w'
jne NOT_ww
inc number_of_characters
NOT_ww:
cmp AL,'x'
jne NOT_xx
inc number_of_characters
NOT_xx:
cmp AL,'y'
jne NOT_yy
inc number_of_characters
NOT_yy:
cmp AL,'z'
jne NOT_zz
inc number_of_characters
NOT_zz:
jne NOTL
inc number_of_capitals
NOTL:
jmp L1
QUITF: ;display result procedure:
call DISP_CHAR
getCharacters ENDP
Explanation / Answer
START PROC
getCharacters PROC
NUBER OF CHARACTERS
mov edx,OFFSET[prompt1]
call WriteString
mov number_of_words,1
mov number_of_Sent,1
mov number_of_sletters,0
mov number_of_characters,0
mov number_of_vowels,0
mov number_of_capitals,0
L1:
call ReadChar
call displayEvry
cmp AL,Sentinel
jne N_Q
mov edx,OFFSET prompt2
call WriteString
MOV AX,OFFSET
L1: MOV DS, AX
INC CHAR
Vowels[SI]
N_Q:
cmp AL,'A'
inc n_O_C
INC A
N_A:
cmp AL,'B'
jne NOT_B
INC B
N_B:
cmp AL,'C'
jne NOT_C
INC C
N_C:
cmp AL,'D'
jne NOT_D
INC D
N_D:
cmp AL,'E'
jne NOT_E
INC E
N_E:
cmp AL,'F'
jne NOT_F
INC F
N_F:
cmp AL,'G'
jne NOT_G
INC G
N_G:
cmp AL,'H'
jne NOT_H
INT H
N_H:
cmp AL,'I'
jne NOT_I
INC I
N_I:
cmp AL,'J'
jne NOT_J
INC J
N_J:
cmp AL,'K'
jne NOT_K
INC K
N_K:
cmp AL,'L'
jne NOT_L
INC K
N_L:
cmp AL,'M'
jne NOT_M
INC M
N_M:
cmp AL,'N'
jne NOT_N
INC N
N_N:
cmp AL,'O'
jne NOT_O
INC O
N_O:
cmp AL,'P'
jne NOT_P
INC P
N_P:
cmp AL,'Q'
jne NOT_Q
INC P
N_Q:
cmp AL,'R'
jne NOT_R
INC Q
N_R:
cmp AL,'S'
jne NOT_S
INC R
N_S:
cmp AL,'T'
jne NOT_T
INC S
N_T:
cmp AL,'U'
jne NOT_U
INC U
N_U:
cmp AL,'V'
jne NOT_V
INC V
N_V:
cmp AL,'W'
jne NOT_W
INC W
N_W:
cmp AL,'X'
jne NOT_X
INC X
N_X:
cmp AL,'Y'
jne NOT_Y
INC Y
N_Y:
cmp AL,'Z'
jne NOT_Z
INC Z
L2:
CODE
MAIN PROC
MOV AL, Vowels[SI]
CMP AL, OFFSET DI
JNZ L3
INC DH
CMP DH, 0AH
JB L3
MOV DH, 00
INC DL
LOOP:
INT 26H
INC CHAR
NOTL:
jmp L1
QUITF:
DSP result procedure:
call DISP_CHAR
getCharacters
ENDP
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.