Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

TASM - select text to display

Status
Not open for further replies.

newby999

Technical User
Jan 9, 2004
1
0
0
GB
Hi,
im quite new to asssembly programming and would like some help to display only lower case characters from an input string of 10 characters eg 12AFasdQW& = asd
the code below is as far as ive got - inputting 10 characters. am i going in the right direction or do i need to start again?
Many thanks

DOSSEG
.MODEL SMALL
.STACK 100H
.DATA
CR EQU 0DH
LF EQU 0AH
HI DB CR,LF, 'Please type in 10 characters, Press Q to quit $'
KEYBUFF DB CR,LF,' $'

.CODE
START: MOV AX,@DATA
MOV DS,AX
MOV AH,09
MOV DX,OFFSET HI
INT 21H

MOV CX, 0AH ;INITIALISE LOOP COUNTER TO 10
MOV BX,OFFSET KEYBUFF ;INITIALISE POINTER TO POINT TO KEYBUFF

MORE: MOV AH, 01 ;SET UP DOS FUNCTION 1
INT 21H

CMP AL,'Q' ;TEST FOR 'Q' TO QUIT
JZ TERMINATE ;AND MOVE TO TERMINATE ROUTINE
CMP AL, 'q' ;TEST FOR 'q' TO QUIT
JZ TERMINATE ;AND MOVE TO TERMINATE ROUTINE


MOV [BX], AL ;SAVE ASCII CODE IN KEYBUFF

INC BX ;INCREMENT KEYBUFF POINTER


DEC CL ;DECREMENT LOOP COUNTER BY 1
JNZ MORE ;IF LOOP COUNTER IS NOT ZERO GO ROUND LOOP AGAIN TILL ZERO

MOV [BX],2400H ;MOVE $ TO END OF STRING


MOV DX, OFFSET KEYBUFF

MOV AH,09H
INT 21

TERMINATE: MOV AX,4C00H
INT 21H
END START
 
Looks to me like you're doing pretty well. If I were you I'd check it all compiles and doesn't crash, and then add on a loop that simply displays all the characters. Then, when that's working, I'd add a conditional jump in the middle of the loop to avoid displaying anything that's not a small letter.
Keep going, at a brief glance you seem to be doing fine.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top