Vous êtes sur la page 1sur 2

;vote2

.model small
.stack 200h
.data
mes db 'Name : $'
nam db 61,62 dup(?)
mes1 db 10,13,'Age : $'
ages db 3,4 dup(?)
mas db 10,13,'Congratulation $'
mas1 db ' you are eligible to vote.$'
mus db 10,13,'Sorry $'
mus1 db ', you are under age.$'
leg db 10,13,'That is an invalid input$'
.code
START:
mov ax, seg mes
mov ds, ax
mov dx, offset mes
mov ah, 09h
int 21h
mov dx, offset nam
mov ah, 0Ah
int 21h
age:
mov dx, offset mes1
mov ah, 09h
int 21h
mov dx, offset ages
mov ah, 0Ah
int 21h
begin:
mov bx, offset ages
mov ch, [bx+2]
mov cl, [bx+3]
cmp cx, '::'
jge notlegit
cmp cx, '00'
jle notlegit
cmp ch, '3'
jge second
jmp third
second:
cmp cl, 00h
jge compare
compare:
cmp cl, 2Fh
jle notlegit
cmp cl, ':'
jge notlegit
jmp done
third:
cmp ch, '1'
jle error
cmp cx, '21'
jge done
jmp error
done:
mov ah, 09h
mov dx, offset mas
int 21h
mov di, offset nam
inc di
mov bl, [di]
mov bh, 0
inc di
mov byte ptr [bx+di], '$'
mov dx, di
mov ah, 09h
int 21h
mov dx, offset mas1
mov ah, 09h
int 21h
.exit
error:
mov ah, 09h
mov dx, offset mus
int 21h
mov di, offset nam
inc di
mov bl, [di]
mov bh, 0
inc di
mov byte ptr [bx+di], '$'
mov dx, di
mov ah, 09h
int 21h
mov dx, offset mus1
mov ah, 09h
int 21h
.exit
notlegit:
mov ah, 09h
mov dx, offset leg
int 21h
jmp age
END START

Vous aimerez peut-être aussi