tchat
pile segment stack
db 200h dup(?)
pile ends
entt struc
Bftype dw 4d42h
Bfsize dd 0
Bfreserved dd ?
Bfoffbits dd ?
bisize dd 0
biwidth dd 0
biheight dd 0
biplanes dw 1
bibicount dw ?
bicomp dd 0
bisizeimage dd 0
bix dd ?
biy dd ?
biclrused dd ?
biclrimp dd ?
entt ends
data segment
x0 dw 312
y0 dw 178
x dw 20
y dw 50
x2 dw 26
y2 dw 56
x3 dw 26
y3 dw 56
x4 dw 26
y4 dw 56
x1 dw 26
y1 dw 56
cst db 20
var db ?
cont db 6
const dw 320
color0 dw 150
color1 dw 130
color2 dw 30
color3 dw 6
color4 dw 100
modei db ?
byt db ?
bmp entt <>
buffer db 0
zone db 64000 dup(0)
handle dw ?
RGB db 3 dup(?)
errouv db 'Erreur ouverture','$'
errlec db 'Erreur de lecture','$'
errdep db 'Erreur de deplacement','$'
errch db 'Erreur lors du chargement','$'
palette db 0
nom db 'image.bmp',0
nom1 db 'image2.bmp',0
nom11 db 'image21.bmp',0
nom12 db 'image22.bmp',0
nom13 db 'image23.bmp',0
nom2 db 'image3.bmp',0
nom3 db 'choix.bmp',0
msg1 db '00',13,'$'
data ends
code segment
assume cs:code, ds:data
deb: mov ax,data
mov ds,ax
mov ax,0a000h
mov es,ax
mov ah,0fh
int 10h
mov modei,al
mov ah,00
mov al,13h ;lire le mode graphique
int 10h
;------------------------------------------------
call entre
lea dx,nom3
call face
mov ax,0000h
int 33h
wait: mov ax,0001h
int 33h
mov ax,0003h
int 33h
cmp bx,2
jz wait
cmp bx,1
jnz wait
cmp dx,70
jb wait
cmp dx,105
ja nbr4
cmp cx,60
jb wait
cmp cx,200
ja nbr3
call play
nbr3: cmp cx,400
jb wait
cmp cx,540
ja wait
call play1
nbr4: cmp dx,120
jb wait
cmp dx,155
ja wait
cmp cx,235
jb wait
cmp cx,375
ja wait
call play2
;call interface
;rejoue:call joeur1
; call joeur2
; call joeur3
; call joeur4
; jmp rejoue
;-------------------------------------------------
fin: mov ah,00
mov al,modei ;restituer le mode
int 10h
mov ah,4ch
int 21h
play proc
mov al,13h
mov ah,00h
int 10h
call interface
rejoue1:call joeur1
call joeur2
jmp rejoue1
ret
play endp
play1 proc
mov al,13h
mov ah,00h
int 10h
call interface
rejoue2:call joeur1
call joeur2
call joeur3
jmp rejoue2
ret
play1 endp
play2 proc
mov al,13h
mov ah,00h
int 10h
call interface
rejoue3:call joeur1
call joeur2
call joeur3
call joeur4
jmp rejoue3
ret
play2 endp
;*****************************************************************
;* Proc‚dures qui affichent la derniŠre page *
;*****************************************************************
bye1 proc
lea dx,nom1
call face
mov ah,00
int 16h
jmp fin
ret
bye1 endp
bye2 proc
lea dx,nom11
call face
mov ah,00
int 16h
jmp fin
ret
bye2 endp
bye3 proc
lea dx,nom12
call face
mov ah,00
int 16h
jmp fin
ret
bye3 endp
bye4 proc
lea dx,nom13
call face
mov ah,00
int 16h
jmp fin
ret
bye4 endp
;****************************************************************
;* Proc‚dure qui affiche la face d'entr‚e *
;****************************************************************
entre proc
lea dx,nom2
call face
mov ah,00
int 16h
ret
entre endp
;****************************************************************
;* Proc‚dure qui affiche l'interface du jeu *
;****************************************************************
interface proc
lea dx,nom
call face
call car_i
mov cx,8
mov x,20
mov y,50
suit:call rec
add y,20
loop suit
add x,20
mov y,50
mov cx,8
suit0:call rec
add y,20
loop suit0
add x,20
mov y,50
mov cx,8
suit1:call rec
add y,20
loop suit1
add x,20
mov y,50
mov cx,8
suit2:call rec
add y,20
loop suit2
add x,20
mov y,50
mov cx,8
suit3:call rec
add y,20
loop suit3
add x,20
mov y,50
mov cx,8
suit4:call rec
add y,20
loop suit4
add x,20
mov y,50
mov cx,8
suit5:call rec
add y,20
loop suit5
add x,20
mov y,50
mov cx,8
suit6:call rec
add y,20
loop suit6
ret
interface endp
;****************************************************************
;* Proc‚dure qui permet d'utiliser le fichier '.bmp' *
;****************************************************************
face proc
mov ax,3d00h
int 21h
jc err1
mov handle,ax
;--------------------lecture dans le fichier-----------
mov bx,Handle
lea dx,bmp
mov cx,size entt
mov ax,3f00h
int 21h
jc err2
jmp nexte
err1: lea dx,errouv
mov ah,09h
int 21h
jmp fini
err2: lea dx,errlec
mov ah,09
int 21h
err3: lea dx,errdep
mov ah,09h
int 21h
err4: lea dx,errch
mov ah,09h
int 21h
nexte: mov ax,4200h
mov bx,handle
mov cx,0
mov dx,size entt
int 21h
mov di,0
cmp word ptr bmp.biclrused,0
jnz nbe
mov si,1
mov cl,byte ptr bmp.bibicount
shl si,cl
jmp map
nbe: mov si, word ptr bmp.biclrused
map: mov bx,handle
mov cx, 4
lea dx,RGB
mov ah,3Fh
int 21h
jc fini
mov bx,di
mov cl,2
shr BYTE PTR RGB, cl
shr BYTE PTR RGB+1, cl
shr BYTE PTR RGB+2, cl
mov dh, BYTE PTR RGB+2
mov ch, BYTE PTR RGB+1
mov cl, BYTE PTR RGB
mov ax,1010h
int 10h
inc di
dec si
jnz map ;end for
mov ax,4200h
mov bx,handle
mov dx,word ptr bmp.Bfoffbits
mov cx,word ptr bmp.Bfoffbits+2
int 21h
mov ax,word ptr bmp.biwidth
mul word ptr bmp.biheight
mov cx,ax
mov si,63680
mov di,64000
boucl: mov ah,3fh ;lecture des donn‚es de l'image et l'afficher directement
push cx
mov cx,1
lea dx,byt
mov bx,handle
int 21h
mov al,byt
mov byte ptr es:[si],al
cmp si,di
jne st5
sub si,640
sub di,320
st5: push bx
lea bx,zone
mov byte ptr ds:[bx+si],al
pop bx
inc si
pop cx
loop boucl
fini:mov ax,3e00h
mov bx,handle
int 21h
ret
face endp
;****************************************************************
;* Fonction qui permet de tracer un carr‚ *
;****************************************************************
carre proc
push bp
mov bp,sp
push si
push di
mov si,[bp+6]
mov di,[bp+4]
mov cx,10
car1: mov ax,si
mul const
add ax,di
mov bx,ax
mov dx,[bp+8]
push cx
mov cx,10
car0: mov byte ptr es:[bx],dl
inc bx
loop car0
pop cx
inc si
loop car1
pop di
pop si
pop bp
ret 6
carre endp
;****************************************************************
;* Proc‚dure qui permet de tracer des lignes *
;****************************************************************
linel proc
mov si,0
etq0: mov di,0
mov ax,0a000h
mov es,ax
mov ax,x
add ax,si
mul const
add ax,y
mov bx,ax
mov byte ptr es:[bx],110
inc si
cmp si,20
jl etq0
ret
linel endp
lineh proc
mov si,0
mov di,0
mov ax,0a000h
mov es,ax
etq: mov ax,x
add ax,si
mul const
add ax,y
add ax,di
mov bx,ax
mov byte ptr es:[bx],110
inc di
cmp di,20
jl etq
ret
lineh endp
lineb proc
mov si,20
mov di,0
mov ax,0a000h
mov es,ax
etq1: mov ax,x
add ax,si
mul const
add ax,y
add ax,di
mov bx,ax
mov byte ptr es:[bx],110
inc di
cmp di,20
jl etq1
ret
lineb endp
liner proc
mov si,0
etq2: mov di,20
mov ax,0a000h
mov es,ax
mov ax,x
add ax,si
mul const
add ax,y
add ax,di
mov bx,ax
mov byte ptr es:[bx],110
inc si
cmp si,20
jl etq2
ret
liner endp
;****************************************************************
;* Proc‚dure pour tracer un rectangle *
;****************************************************************
rec proc
call linel
call lineh
call lineb
call liner
ret
rec endp
;****************************************************************
;* Proc‚dure pour tracer un carr‚ *
;****************************************************************
car_i proc
mov si,0
suiv2:mov di,0
mov ax,0a000h
mov es,ax
suiv3:mov ax,20
add ax,si
mul const
add ax,50
add ax,di
mov bx,ax
mov byte ptr es:[bx],150
inc di
cmp di,160
jl suiv3
inc si
cmp si,160
jl suiv2
ret
car_i endp
;****************************************************************
;* Proc‚dure qui permet de tirer al‚atoirement un nombre entre *
;* un nombre entre 1 et 6 *
;****************************************************************
des proc
mov ax,40h
mov es,ax
mov al,es:[6ch]
div cont
add ah,1
mov var,ah
or ah,30h
mov msg1+1,ah
mov ah,02
mov dh,17
mov dl,34
int 10h
lea dx,msg1
mov ah,09
int 21h
;-----------------------------------------------------------
;----------------Affichage des positions des cases----------
mov ah,02h
mov dh,3
mov dl,7
int 10h
mov al,30h
mov bl,39h
mov ah,0eh
int 10h
mov ah,02h
mov dh,3
mov dl,22
int 10h
mov al,36h
mov bl,39h
mov ah,0eh
int 10h
mov ah,02h
mov dh,11
mov dl,25
int 10h
mov al,58h
mov bl,130
mov ah,0eh
int 10h
mov ah,02h
mov dh,16
mov dl,12
int 10h
mov al,21h
mov bl,39h
mov ah,0eh
int 10h
mov ah,02h
mov dh,18
mov dl,17
int 10h
mov al,58h
mov bl,130
mov ah,0eh
int 10h
mov ah,02h
mov dh,21
mov dl,12
int 10h
mov al,3fh
mov bl,130
mov ah,0eh
int 10h
mov ah,02h
mov dh,21
mov dl,25
int 10h
mov al,46h
mov bl,0eh
mov ah,0eh
int 10h
mov ah,02h
mov dh,6
mov dl,17
int 10h
mov al,21h
mov bl,39h
mov ah,0eh
int 10h
ret
des endp
;****************************************************************
;* Proc‚dure qui permet d'utiliser la souris *
;****************************************************************
souris proc
mov ax,0000h
int 33h
for:mov ax,0001h
int 33h
mov ax,0003h
int 33h
cmp bx,2
jz fine
cmp bx,1
jnz for
cmp cx,520
jb str
cmp cx,560
ja str
cmp dx,70
jb str
cmp dx,130
ja str
call des
jmp saut
str:cmp dx,150
jb for
cmp dx,190
ja for
cmp cx,0
jb for
cmp cx,60
ja for
fine:jmp fin
saut:
ret
souris endp
;****************************************************************
;* Proc‚dure qui permet de positionner le joeur 1 *
;****************************************************************
joeur1 proc
cmp x2,86
jnz k01 ;test sur la case 31
cmp y2,196
jz k02
k01: cmp x2,146
jnz k0 ;test sur la case 52
cmp y2,136
jnz k0
k02: mov dx,x3
cmp x2,dx ;test avec le joeur 2
jz k03
mov dx,x4
cmp x2,dx ;test avec le joeur 3
jz k04
mov dx,x1
cmp x2,dx ;test avec le joeur 4
jz k05
jmp bcl
k03: mov dx,y3
cmp y2,dx
jz k0
jmp bcl
k04: mov dx,y4
cmp y2,dx
jz k0
jmp bcl
k05: mov dx,y1
cmp y2,dx
jz k0
jmp bcl
k0:call souris ;appel de proc‚dure de la souris
mov ax,0002
int 33h
mov ax,0a000h
mov es,ax
push color1
mov si,x0
push si
mov di,y0
push di
call carre
push color0
mov si,x2
push si
mov di,y2
push di
call carre
mov al,var
mul cst
add y2,ax
bcl: cmp x2,126
jnz k9
cmp y2,96 ;test sur la case 42 pour aller al case 30
jnz k9
mov x2,86
mov y2,176
k9: cmp x2,166
jnz k1
cmp y2,196 ;test sur la case 63, c'est la case d'arriv‚e
jnz k1
call bye1
k1: cmp x2,166
jnz k2
cmp y2,96 ;test sur la case 58 (tete de mort)
jnz k2
mov x2,26
mov y2,56
k2: cmp x2,46
jnz k3
cmp y2,136 ;test sur la case 12 pour retourner … 6
jnz k3
mov x2,26
mov y2,176
jmp k4
k3: cmp x2,26
jnz k4
cmp y2,176 ;test sur la case 6 pour aller a 12
jnz k4
mov x2,46
mov y2,136
k4: cmp x2,166
jb k5
cmp y2,196 ;test si le joeur d‚passe la case 63
jbe k5 ;de m cases il doit reculer de m cases
sub y2,196 ;… partir de la case 63
mov ax,y2
mov y2,196
sub y2,ax
jmp k7
k5: cmp y2,196
jbe f1
sub y2,216 ;test sur l'extr‚mit‚ du plateau
add x2,20
add y2,56
cmp x2,46
jnz k6
cmp y2,136 ;test sur la case 12
jnz k6
mov x2,26
mov y2,176
k6: cmp x2,126
jnz k7
cmp y2,96 ;test sur la case 42
jnz k7
mov x2,86
mov y2,176
k7: cmp x2,166
jnz k8
cmp y2,96 ;test sur la case 58 (tete de mort)
jnz k8
mov x2,26
mov y2,56
k8: cmp x2,166
jnz f1
cmp y2,196 ;test sur la case 63 la case d'arriv‚e
jnz f1
call bye1
f1: push color1
mov si,x2
push si
mov di,y2
push di
call carre ;appel de proc‚dure de carr‚
ret
joeur1 endp
;****************************************************************
;* Proc‚dure qui permet de positionner le joeur 2 *
;****************************************************************
joeur2 proc
cmp x3,86
jnz l01
cmp y3,196
jz l02
l01: cmp x3,146
jnz l0
cmp y3,136
jnz l0
l02: mov dx,x2
cmp x3,dx
jz l03
mov dx,x4
cmp x3,dx
jz l04
mov dx,x1
cmp x3,dx
jz l05
jmp bcle
l03: mov dx,y2
cmp y3,dx
jz l0
jmp bcle
l04: mov dx,y4
cmp y3,dx
jz l0
jmp bcle
l05: mov dx,y1
cmp y3,dx
jz l0
jmp bcle
l0:call souris
mov ax,0002
int 33h
mov ax,0a000h
mov es,ax
push color2
mov si,x0
push si
mov di,y0
push di
call carre
push color0
mov si,x3
push si
mov di,y3
push di
call carre
mov al,var
mul cst
add y3,ax
bcle:cmp x3,126
jnz l9
cmp y3,96
jnz l9
mov x3,86
mov y3,176
l9: cmp x3,166
jnz l1
cmp y3,196
jnz l1
call bye2
l1: cmp x3,166
jnz l2
cmp y3,96
jnz l2
mov x3,26
mov y3,56
l2: cmp x3,46
jnz l3
cmp y3,136
jnz l3
mov x3,26
mov y3,176
jmp l4
l3: cmp x3,26
jnz l4
cmp y3,176
jnz l4
mov x3,46
mov y3,136
l4: cmp x3,166
jb l5
cmp y3,196
jbe l5
sub y3,196
mov ax,y3
mov y3,196
sub y3,ax
jmp l7
l5: cmp y3,196
jbe fi1
sub y3,216
add x3,20
add y3,56
cmp x3,46
jnz l6
cmp y3,136
jnz l6
mov x3,26
mov y3,176
l6: cmp x3,126
jnz l7
cmp y3,96
jnz l7
mov x3,86
mov y3,176
l7: cmp x3,166
jnz l8
cmp y3,96
jnz l8
mov x3,26
mov y3,56
l8: cmp x3,166
jnz fi1
cmp y3,196
jnz fi1
call bye2
fi1: push color2
mov si,x3
push si
mov di,y3
push di
call carre
ret
joeur2 endp
;****************************************************************
;* Proc‚dure qui permet de positionner le joeur 3 *
;****************************************************************
joeur3 proc
cmp x4,86
jnz m01
cmp y4,196
jz m02
m01: cmp x4,146
jnz m0
cmp y4,136
jnz m0
m02: mov dx,x3
cmp x4,dx
jz m03
mov dx,x2
cmp x4,dx
jz m04
mov dx,x1
cmp x4,dx
jz m05
jmp bou
m03: mov dx,y3
cmp y4,dx
jz m0
jmp bou
m04: mov dx,y2
cmp y4,dx
jz m0
jmp bou
m05: mov dx,y1
cmp y4,dx
jz m0
jmp bou
m0:call souris
mov ax,0002
int 33h
mov ax,0a000h
mov es,ax
push color3
mov si,x0
push si
mov di,y0
push di
call carre
push color0
mov si,x4
push si
mov di,y4
push di
call carre
mov al,var
mul cst
add y4,ax
bou: cmp x4,126
jnz m9
cmp y4,96
jnz m9
mov x4,86
mov y4,176
m9: cmp x4,166
jnz m1
cmp y4,196
jnz m1
call bye3
m1: cmp x4,166
jnz m2
cmp y4,96
jnz m2
mov x4,26
mov y4,56
m2: cmp x4,46
jnz m3
cmp y4,136
jnz m3
mov x4,26
mov y4,176
jmp m4
m3: cmp x4,26
jnz m4
cmp y4,176
jnz m4
mov x4,46
mov y4,136
m4: cmp x4,166
jb m5
cmp y4,196
jbe m5
sub y4,196
mov ax,y4
mov y4,196
sub y4,ax
jmp m7
m5: cmp y4,196
jbe f2
sub y4,216
add x4,20
add y4,56
cmp x4,46
jnz m6
cmp y4,136
jnz m6
mov x4,26
mov y4,176
m6: cmp x4,126
jnz m7
cmp y4,96
jnz m7
mov x4,86
mov y4,176
m7: cmp x4,166
jnz m8
cmp y4,96
jnz m8
mov x4,26
mov y4,56
m8: cmp x4,166
jnz f2
cmp y4,196
jnz f2
call bye3
f2: push color3
mov si,x4
push si
mov di,y4
push di
call carre
ret
joeur3 endp
;****************************************************************
;* Proc‚dure qui permet de positionner le joeur 4 *
;****************************************************************
joeur4 proc
cmp x1,86
jnz n01
cmp y1,196
jz n02
n01: cmp x1,146
jnz n0
cmp y1,136
jnz n0
n02: mov dx,x3
cmp x1,dx
jz n03
mov dx,x4
cmp x1,dx
jz n04
mov dx,x2
cmp x1,dx
jz n05
jmp boul
n03: mov dx,y3
cmp y1,dx
jz n0
jmp boul
n04: mov dx,y4
cmp y1,dx
jz n0
jmp boul
n05: mov dx,y2
cmp y1,dx
jz n0
jmp boul
n0:call souris
mov ax,0002
int 33h
mov ax,0a000h
mov es,ax
push color4
mov si,x0
push si
mov di,y0
push di
call carre
push color0
mov si,x1
push si
mov di,y1
push di
call carre
mov al,var
mul cst
add y1,ax
boul:cmp x1,126
jnz n9
cmp y1,96
jnz n9
mov x1,86
mov y1,176
n9: cmp x1,166
jnz n1
cmp y1,196
jnz n1
call bye4
n1: cmp x1,166
jnz n2
cmp y1,96
jnz n2
mov x1,26
mov y1,56
n2: cmp x1,46
jnz n3
cmp y1,136
jnz n3
mov x1,26
mov y1,176
jmp n4
n3: cmp x1,26
jnz n4
cmp y1,176
jnz n4
mov x1,46
mov y1,136
n4: cmp x1,166
jb n5
cmp y1,196
jbe n5
sub y1,196
mov ax,y1
mov y1,196
sub y1,ax
jmp n7
n5: cmp y1,196
jbe f3
sub y1,216
add x1,20
add y1,56
cmp x1,46
jnz n6
cmp y1,136
jnz n6
mov x1,26
mov y1,176
n6: cmp x1,126
jnz n7
cmp y1,96
jnz n7
mov x1,86
mov y1,176
n7: cmp x1,166
jnz n8
cmp y1,96
jnz n8
mov x1,26
mov y1,56
n8: cmp x1,166
jnz f3
cmp y1,196
jnz f3
call bye4
f3: push color4
mov si,x1
push si
mov di,y1
push di
call carre
ret
joeur4 endp
code ends
end deb