ما تمرینات دانشگاه رو انجام نمیدیم، ولی چون فرض میکنم پرچم ایران رو خودتون نوشتید، بقیش یکم دستکاری میخواد.
اینم کد نهایی:
.model small.stack 100h
.data
m db "((i))","$"
msg db "Enter 0 or 1:$"
.code
main proc
mov ax,@data
mov ds,ax
;set background color= white and characters black
mov ah,06h
mov al,0
mov cx,0
mov dl,80
mov dh,80
mov bh,0F0h
int 10h
while:
;move cursor to 0,0 position
mov ah,02h
mov dl,0
mov dh,0
mov bh,0
int 10h
;show message
mov dx,offset msg
mov ah,9
int 21h
;get a charachter
mov ah,1
int 21h
cmp al,'1'
jz one
cmp al,'0'
jz zero
jmp exit
one:
call iranflag
jmp while
zero:
call germanyflag
jmp while
exit:
;exit but never used
mov ax,4c00h
int 21h
main endp
proc iranflag
;green
mov ah,06h
mov al,4
mov cl,20
mov ch,6
mov dl,40
mov dh,9
mov bh,20h
int 10h
;white
mov ah,06h
mov al,4
mov cl,20
mov ch,10
mov dl,40
mov dh,13
mov bh,70h
int 10h
;red
mov ah,06h
mov al,4
mov cl,20
mov ch,14
mov dl,40
mov dh,17
mov bh,40h
int 10h
;.......
mov ah,02h
mov dh,11
mov dl,28
mov bh,0
int 10h
;
mov ah,09h
lea dx,m
int 21h
ret
iranflag endp
proc germanyflag
;black
mov ah,06h
mov al,4
mov cl,20
mov ch,6
mov dl,40
mov dh,9
mov bh,00h
int 10h
;red
mov ah,06h
mov al,4
mov cl,20
mov ch,10
mov dl,40
mov dh,13
mov bh,40h
int 10h
;yellow
mov ah,06h
mov al,4
mov cl,20
mov ch,14
mov dl,40
mov dh,17
mov bh,0e0h
int 10h
ret
germanyflag endp
end main