- #1
kloong
- 36
- 0
this is my code to convert lower case strings to upper case.
i want to ask the user whether to continue or not. but no matter what i type, the prog keeps stoping. try to copy paste this code to ur emulator and u'll know what I am saying.
also, how should i replace the include 'emu8086.inc' with??
.
.MODEL SMALL
.STACK 100H
.DATA
MSG1 DB 0DH,0AH,"ENTER A LOWER CASE LETTER: $"
MSG2 DB 0DH,0AH, "IN UPPER CASE IT IS:"
CHAR DB ?, "$"
.CODE
MAIN PROC
include 'emu8086.inc'
MOV AX, @DATA
MOV DS, AX
label3:
LEA DX, MSG1
MOV AH, 9
INT 21H
MOV AH, 1
INT 21H
CMP AL, 'z'
JG label1
CMP AL, 'a'
JL label2
SUB AL, 20H
MOV CHAR, AL
LEA DX, MSG2
MOV AH,9
INT 21H
JMP label4
label1:
PRINT ' Please enter a lower case alphabet for conversion!'
jmp label3
label2:
PRINT ' Please enter a lower case alphabet for conversion!'
jmp label3
label4:
PRINT ' Do you want to continue?<y/n>'
MOV AH, 1
INT 21H
CMP AL, 'n'
int 20h
CMP AL, 'y'
jmp label3
exit:
MAIN ENDP
END MAIN
i want to ask the user whether to continue or not. but no matter what i type, the prog keeps stoping. try to copy paste this code to ur emulator and u'll know what I am saying.
also, how should i replace the include 'emu8086.inc' with??
.
.MODEL SMALL
.STACK 100H
.DATA
MSG1 DB 0DH,0AH,"ENTER A LOWER CASE LETTER: $"
MSG2 DB 0DH,0AH, "IN UPPER CASE IT IS:"
CHAR DB ?, "$"
.CODE
MAIN PROC
include 'emu8086.inc'
MOV AX, @DATA
MOV DS, AX
label3:
LEA DX, MSG1
MOV AH, 9
INT 21H
MOV AH, 1
INT 21H
CMP AL, 'z'
JG label1
CMP AL, 'a'
JL label2
SUB AL, 20H
MOV CHAR, AL
LEA DX, MSG2
MOV AH,9
INT 21H
JMP label4
label1:
PRINT ' Please enter a lower case alphabet for conversion!'
jmp label3
label2:
PRINT ' Please enter a lower case alphabet for conversion!'
jmp label3
label4:
PRINT ' Do you want to continue?<y/n>'
MOV AH, 1
INT 21H
CMP AL, 'n'
int 20h
CMP AL, 'y'
jmp label3
exit:
MAIN ENDP
END MAIN