hi guys pls. help me with this. I want to limit the times when the user would guess the word for 3 trials only. How will i do that?

PLs. see my code below:

TRYAGAIN:
mov cx, 12
mov bx, 0

AGAIN:
mov ah, 01h 		; read a char from KB with echoing on screen
int 21h 			; stores the char read in al
cmp al, 0dh 		; cmp al with <cr>(0dh)
je ACTION
mov ENTRY[bx], al 	; stores the chars read in entry[]
inc bx
loop AGAIN 			; to read next char from KB


ACTION:
mov ENTRY[bx], '$' 	; store $ at the end of the array
lea si, ANSWER
lea di, ENTRY 
mov cx, 011 		; cx = 11 length of the answer
repe cmpsb 			; cmp si(answer) & di(entry)
je VIEWMSG
lea dx, M3
mov ah, 09h
int 21h
jmp TRYAGAIN

Edited 5 Years Ago by bettybarnes: n/a

.data
Counter dd 0
...
TRYAGAIN:
mov cx, 12
mov bx, 0

AGAIN:
mov ah, 01h 		; read a char from KB with echoing on screen
int 21h 			; stores the char read in al
cmp al, 0dh 		; cmp al with <cr>(0dh)
je ACTION
mov ENTRY[bx], al 	; stores the chars read in entry[]
inc bx
loop AGAIN 			; to read next char from KB


ACTION:
mov ENTRY[bx], '$' 	; store $ at the end of the array
lea si, ANSWER
lea di, ENTRY 
mov cx, 011 		; cx = 11 length of the answer
repe cmpsb 			; cmp si(answer) & di(entry)
je VIEWMSG
lea dx, M3
mov ah, 09h
int 21h
jmp TRYAGAIN

CheckTimes:
CMP Counter, 3      ;compare the counter value with 3
JL TRYAGAIN         ;JUMP IF LOWER THAN to tryagain
PUSH 0
CALL ExitProcess    ;Quit the program if its bigger or equal than 3

this is the problem "argument to operation or instruction has illegal size"

.data
counter dd 0

This article has been dead for over six months. Start a new discussion instead.