Hi guys i need to write a program that reads a line from the user and then searches and counts the number of alphabet letters in it and the number of any one punctuation.
i figured out how to go through the list of all uppercase and lowercase letters and punctuations ':' and ';' but wanna know how to compare with each character in the line.
im using assmbly lang for intel IA-32 and MASM 8
ive used macros to read the line and display it the definition of the macros is given
PLEASE HELP!
;------------------------------------------------------
mReadString MACRO varName:REQ
;
; Reads from standard input into a buffer.
; Receives: the name of the buffer. Avoid passing
; ECX and EDX as arguments.
;------------------------------------------------------
push ecx
push edx
mov edx,OFFSET varName
mov ecx,SIZEOF varName
call ReadString
pop edx
pop ecx
ENDM
;------------------------------------------------------
mWriteString MACRO buffer:REQ
;
; Writes a string variable to standard output.
; Receives: string variable name.
;------------------------------------------------------
push edx
mov edx,OFFSET buffer
call WriteString
pop edx
ENDM
INCLUDE Irvine32.inc
INCLUDE Macros.inc
.data
mPutchar MACRO char
push eax
mov al,char
call WriteChar
pop eax
ENDM
sen BYTE 500 DUP(?)
.code
main PROC
call ClrScr ;Clear screen
mWrite<" Input a sentence to see the number of alphabet letters and punctuation",0dh,0ah>
mReadString sen
call Crlf
mWrite<"Sentence input by user..",0dh,0ah>
mWriteString sen
call Crlf
mov edx, OFFSET sen
call WriteChar
call Crlf
mov al,65
mov ecx,26
L1:
mPutchar al ;macro call
inc al
call Crlf
loop L1
mov al,97
mov ecx,26
L2:
mPutchar al
inc al
Call Crlf
loop L2
mov al,58
mov ecx,2
L3:
mPutchar al
inc al
Call Crlf
loop L3
exit
main ENDP
END main