Assignment Help, Cloud Based ERP System, Microsoft NAV Certification
WELCOME !!

Please Register, ask for assignment solutions & post the solutions if you know any.

LETS START POSTING YOUR IDEAS AND THOUGHTS AND BUILD THE COMMUNITY OF EXPERTS.

Assignment Help, Cloud Based ERP System, Microsoft NAV Certification
WELCOME !!

Please Register, ask for assignment solutions & post the solutions if you know any.

LETS START POSTING YOUR IDEAS AND THOUGHTS AND BUILD THE COMMUNITY OF EXPERTS.

Assignment Help, Cloud Based ERP System, Microsoft NAV Certification

Stock Market, Online Tutoring, Cloud Based ERP System, Microsoft Dynamics Reporting, Microsoft Nav Certification

Similar topics

You are not connected. Please login or register

View previous topic View next topic Go down  Message [Page 1 of 1]

1COUNT AND DISPLAY THE WORDS Empty COUNT AND DISPLAY THE WORDS 11th March 2009, 2:49 pm

diadem59

diadem59
Administrator
Write an ALP to count the no. of words and display the count and the words in separate lines on a defined window (5,10 and 20,70) with white on blue attribute.

SOLUTION:

Code:
TITLE COUNT AND DISPLAY THE WORDS

DOSSEG

.STACK 64H
.DATA
REQ DB 'ENTER THE LINE OF TEXT:',0AH,0DH,'$'
WDN DB 'The Total No. Of Words are: ','$'
WDS DB 0AH,0DH,'          The Words are:',0DH,0AH,'          $'
NXLN DB 0AH,0DH,'          $'
DOT DB '- $'

MAXM DB 50H
ACT  DB ?
CHAR DB 50H DUP (?)

TEMP DB 02 DUP (?)
DIVS DB 0AH 

.CODE
MAIN PROC
MOV AX,@DATA
MOV DS,AX 
MOV ES,AX

LEA DX,REQ
MOV AH,09H
INT 21H

MOV AH,0AH
LEA DX,MAXM
INT 21H

MOV AH,06H
MOV AL,00
MOV BH,17H  ;White on Blue
MOV CX,050AH
MOV DH,20
MOV DL,70
INT 10H

MOV AH,02 
MOV BH,00H
MOV DX,050AH
INT 10H

MOV BX,01
MOV CH,00
MOV CL,ACT
MOV DI,OFFSET CHAR
ADD DI,CX
MOV [DI],'$'
 
Agn: CMP [DI],' '
JNE Skip
INC BL
MOV [DI],'$'
PUSH DI
Skip:  DEC DI
LOOP Agn

LEA DX,WDN
MOV AH,09H
INT 21H

MOV CL,BL
CALL DISPBX

MOV BX,01H
MOV AH,09H

MOV DX,OFFSET WDS
INT 21H
               
PUSH OFFSET ACT

Redisp:
LEA DX,NXLN
INT 21H
MOV DX,OFFSET DOT
INT 21H 

POP DX
INC DX
INT 21H 
INC BX
LOOP Redisp

MOV AX,4C00H
INT 21H
MAIN ENDP

DISPBX PROC

MOV AX,BX
MOV SI,00 
Rediv:  DIV DIVS
MOV TEMP[SI],AH
MOV AH,00
INC SI
TEST AL,0FFH
JNZ Rediv

MOV AH,02
Nextdgt:  DEC SI
MOV DL,TEMP[SI]
ADD DL,30H
INT 21H
TEST SI,0FFFH
JNE Nextdgt

RET
DISPBX ENDP

END MAIN

2COUNT AND DISPLAY THE WORDS Empty Re: COUNT AND DISPLAY THE WORDS 23rd February 2011, 11:40 pm

8086!@


Nice sample code. Can I ask more favor? can you give me an example code for this kind of questions. Thank you

Write an 8088 assembly language program to count the number of characters, words and the letter
O (both upper and lower case are counted) in a sentence. Note than letter O has an ASCII value of 4Fh
while letter o has an ASCII value of 6Fh. The program has the following specifications:
1. Input sentence string is limited to a maximum of 80 characters.
2. The sentence is terminated with a period.
3. No characters and words will be counted beyond the period
4. One and only one space separating the words
5. Spaces are counted towards the character count but period is not counted
6. Prompt the user with "Do you want to try again?” after each run.
The program should also be able to check the following:
• Null input
• No termination (i.e., no period at the end of the sentence)
• Two or more spaces between words

View previous topic View next topic Back to top  Message [Page 1 of 1]

Permissions in this forum:
You cannot reply to topics in this forum