1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218
| name "projet"
org 100h
pos_y db 20 ;variable curseur caractere
pos_x db 19
pos_y_shoot db 0 ; variable curseur shoot
pos_x_shoot db 0
pos_mur_1_x db 10
pos_mur_1_y db 18
pos_mur_2_x db 11
pos_mur_2_y db 18
pos_mur_3_x db 12
pos_mur_3_y db 18
pos_mur_4_x db 17
pos_mur_4_y db 18
pos_mur_5_x db 18
pos_mur_5_y db 18
pos_mur_6_x db 19
pos_mur_6_y db 18
pos_mur_7_x db 24
pos_mur_7_y db 18
pos_mur_8_x db 25
pos_mur_8_y db 18
pos_mur_9_x db 26
pos_mur_9_y db 18
pos_en_x db 9
pos_en_y db 10
pos_mur_x db 9
pos_mur_y db 18
compteur db 6
compteur_2 db 4
affiche_ennemi: ; affiche l'ennemi
add pos_en_x,4
MOV DH,pos_en_y ; Met la ligne dans le registre
MOV DL,pos_en_x ; Met la colonne dans le registre
MOV AH,02h ; Fixe le numero de la fonction
MOV BH,0 ; Fixe le numero de la page, soit 0
INT 10h ; Appelle l'interruption video (10h)
MOV AL, 'X'
MOV AH, 09h
MOV BL, 0ah
MOV CX, 1
int 10h
dec compteur
cmp compteur, 0
jne affiche_ennemi
mov compteur, 6
dec compteur_2
add pos_en_y, 2
mov pos_en_x, 3
cmp compteur_2, 0
jne affiche_ennemi
mur_1 :
call pos_curseur_mur
MOV AL, 04h
MOV AH, 09h
MOV BL, 0ah
MOV CX, 3
int 10h
add pos_mur_x, 6
mur_2:
call pos_curseur_mur
MOV AL, 04h
MOV AH, 09h
MOV BL, 0ah
MOV CX, 3
int 10h
add pos_mur_x, 6
mur_3:
call pos_curseur_mur
MOV AL, 04h
MOV AH, 09h
MOV BL, 0ah
MOV CX, 3
int 10h
add pos_mur_x, 6
mur_4:
call pos_curseur_mur
MOV AL, 04h
MOV AH, 09h
MOV BL, 0ah
MOV CX, 3
int 10h
add pos_mur_x, 6
;position du curseur
pos_curseur:
MOV DH,pos_y ; Met la ligne dans le registre
MOV DL,pos_x ; Met la colonne dans le registre
MOV AH,02h ; Fixe le numero de la fonction
MOV BH,0 ; Fixe le numero de la page, soit 0
INT 10h ; Appelle l'interruption video (10h)
jmp affiche
partie:
call affiche
;affiche le caractere a la position du curseur
affiche:
MOV AL, 01eh
MOV AH, 09h
MOV BL, 0ah
MOV CX, 1
int 10h
jmp attente
;Verification de la touche utilisateur
attente:
MOV DH,pos_y ; Met la ligne dans le registre
MOV DL,pos_x ; Met la colonne dans le registre
MOV AH,02h ; Fixe le numero de la fonction
MOV BH,0 ; Fixe le numero de la page, soit 0
INT 10h ; Appelle l'interruption video (10h)
mov ah, 01h
int 16h
mov ah, 00h
int 16h
cmp ax, 4b00h ; left key?
je move_left ;
cmp ax, 4d00h ; right key?
je move_right ;
;shoot
cmp ax, 3920h
je preshoot;
ret
move_left:
call efface
dec pos_x
call pos_curseur
mov ah, 02h
mov bh, 0
int 10h
jmp affiche
move_right:
call efface
inc pos_x
call pos_curseur
mov ah, 02h
mov bh, 0
int 10h
jmp affiche
efface:
MOV AL, 'A'
MOV AH, 09h
MOV BL, 00h
MOV CX, 1
int 10h
ret
preshoot: ; place le curseur au dessus du caractere pour demarrer le shoot
mov al, pos_y
mov pos_y_shoot, al
mov al, pos_x
mov pos_x_shoot, al
dec pos_y_shoot
call position_curseur_shoot
shoot: ; affiche le shoot
mov al,018h
mov ah, 09h
mov bl, 01h
mov cx, 1
int 10h
call efface ;efface le shoot precedent
cmp pos_y_shoot,0h ; compare la hauteur avec 0 (il faut rajouter le cas ou le shoot s'efface quand il vaut 0)
je attente
dec pos_y_shoot ;met la pos_y au dessus
position_curseur_shoot:
MOV DH,pos_y_shoot ; Met la ligne dans le registre
MOV DL,pos_x_shoot ; Met la colonne dans le registre
MOV AH,02h ; Fixe le numero de la fonction
MOV BH,0 ; Fixe le numero de la page, soit 0
INT 10h ; Appelle l'interruption video (10h)
jmp shoot
pos_curseur_mur:
MOV DH,pos_mur_y ; Met la ligne dans le registre
MOV DL,pos_mur_x ; Met la colonne dans le registre
mov ah, 02h
mov bh,0
int 10h
ret
pos_curseur_en:
MOV DH,pos_en_y ; Met la ligne dans le registre
MOV DL,pos_en_x ; Met la colonne dans le registre
mov ah, 02h
mov bh,0
int 10h
ret |
Partager