data SEGMENT
msg_entrer db "Afficher 'Bonne chance'? Entrer 'Oui' si oui : ",'$'
msg_chance db "Bonne chance",'$'
chaine_reponse db 10 dup('?'), '$'
chaine_oui db "OUI",'$'
data ENDS
code SEGMENT
ASSUME DS: data, CS: code
debut:
MOV AX, data
MOV DS, AX
boucle:
MOV DX, offset msg_entrer
MOV AH, 09H
INT 21H
CALL lire_reponse
MOV DL, 0Ah
MOV AH, 02H
INT 21H
MOV DX, offset msg_chance
MOV AH, 09H
INT 21H
MOV DL, 0AH
MOV AH, 02H
INT 21H
JMP boucle
fin:
MOV AH, 4Ch
INT 21H
lire_reponse PROC near
MOV DX, offset chaine_reponse
MOV AH, 0Ah
INT 21H
CALL verifier
RET
lire_reponse ENDP
verifier PROC near
MOV AL, [chaine_reponse + 1]
CMP AL, 3
JNE fin
MOV BX, offset chaine_reponse + 2
MOV SI, offset chaine_oui
MOV CL, 0
boucle_comparer:
CMP CL, 3
JE egaux
MOV AL, [BX]
AND AL, 11011111b
MOV AH, [SI]
AND AH, 11011111b
CMP AL, AH
JNE FIN
INC BX
INC SI
INC CL
JMP boucle_comparer
egaux:
RET
verifier ENDP
code ENDS
END debut
Si vous avez des questions, vous pouvez les poser à l'assistant IA.