-
Notifications
You must be signed in to change notification settings - Fork 0
/
PF.asm
276 lines (196 loc) · 10.1 KB
/
PF.asm
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
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
page 60, 132
title "Proyecto Final"
.model small
.stack 256
dataseg
texto db 'AQUI TOY'
exCode db 0
; Las siguientes lineas son de mi mapa
cad1 db 178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,178
cad2 db 178,32,32,32,32,32,32,32,32,32,32,178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,178
cad3 db 178,178,178,178,178,178,178,178,178,178,32,178,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,178,32,178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,32,178
cad4 db 178,32,32,32,32,32,32,178,178,178,32,178,32,178,178,32,178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,32,178,178,178,178,178,178,178,32,178,32,178,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,178
cad5 db 178,32,178,178,178,178,32,178,178,32,32,178,32,178,178,178,178,178,178,178,178,32,178,178,178,178,178,32,32,32,32,32,178,178,178,32,32,32,32,32,32,32,32,32,178,178,32,178,178,178,178,178,178,178,32,178,32,178,32,178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,32,178
cad6 db 178,32,32,32,178,178,32,178,178,32,178,178,32,178,32,32,32,32,32,32,32,32,32,32,32,178,178,32,178,178,178,32,32,32,178,32,178,178,178,178,178,178,178,32,178,178,32,32,32,32,32,32,32,178,32,178,32,178,32,178,178,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,178
cad7 db 178,32,178,32,32,178,32,178,178,32,178,178,32,178,32,178,178,178,178,178,178,178,178,178,32,32,178,32,178,178,178,32,178,32,178,32,32,32,32,32,178,178,178,32,178,178,178,178,178,178,178,178,32,178,32,178,32,178,32,32,178,32,178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,178
cad8 db 178,32,178,178,32,178,32,178,32,32,32,32,32,178,32,178,178,32,32,32,32,32,32,178,32,178,178,32,178,178,178,32,178,32,178,32,178,178,178,32,178,178,178,32,178,178,178,178,178,178,178,178,178,178,32,178,32,178,178,32,178,32,178,32,32,32,32,32,178,178,178,178,178,32,32,32,178,178,32,178
cad9 db 178,32,178,178,32,178,32,178,32,178,178,178,178,178,32,178,178,32,178,178,178,178,178,178,32,178,178,32,178,178,178,32,178,32,178,32,178,178,178,32,32,32,178,32,32,32,32,32,32,32,32,32,32,32,32,178,32,178,178,32,178,32,178,32,178,178,178,32,178,32,32,32,178,32,178,32,32,32,32,178
cad10 db 178,32,178,178,32,178,32,178,32,178,178,178,178,178,32,178,32,32,32,32,32,32,178,178,32,178,32,32,178,178,178,32,178,32,178,32,178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,32,178,178,32,178,32,178,32,178,178,178,32,178,32,178,32,178,32,178,32,178,178,178,178
cad11 db 178,32,178,32,32,178,32,178,32,32,32,32,32,32,32,178,32,178,178,178,178,32,178,178,32,178,178,32,32,32,178,32,178,32,178,32,178,178,178,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,178,32,32,178,32,178,32,178,178,32,32,178,32,178,32,178,32,178,32,178,178,178,178
cad12 db 32,32,178,32,178,178,32,178,178,178,178,178,178,178,178,178,32,178,178,178,178,32,178,178,32,178,178,32,178,32,178,32,32,32,178,32,178,178,178,32,178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,32,178,178,32,178,32,178,178,32,178,178,32,178,32,32,32,178,32,32,32,234,178
cad13 db 178,178,178,32,178,178,32,178,178,178,178,178,178,178,32,178,32,178,178,178,178,32,178,178,32,178,178,32,178,32,178,32,178,178,178,32,178,32,178,32,178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,32,178,32,32,178,32,178,32,32,178,178,178,178,178,178,32,178,178,178
cad14 db 178,32,32,32,178,178,32,32,32,32,32,32,32,178,32,178,32,178,32,32,32,32,178,178,32,178,178,32,178,32,178,32,32,32,32,32,178,32,178,32,178,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,178,178,32,178,32,178,178,32,178,178,178,178,178,178,32,178,178,178
cad15 db 178,178,178,178,178,178,178,178,178,32,178,178,32,178,32,178,32,178,32,178,178,178,178,178,32,178,178,32,178,32,178,178,178,178,178,178,178,32,178,32,178,32,178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,32,178,32,178,178,32,32,32,32,32,32,32,32,178,178,178
cad16 db 178,178,32,32,32,32,32,32,32,32,178,178,32,178,32,178,32,178,32,178,178,178,178,178,32,178,178,32,178,32,178,178,178,178,178,32,32,32,178,32,178,32,32,32,32,32,32,178,178,178,178,32,32,32,178,32,32,32,32,32,32,32,32,32,32,32,32,178,178,178,178,178,178,178,178,178,32,178,178,178
cad17 db 178,178,32,178,178,178,178,178,178,178,178,178,32,178,32,178,32,178,32,178,178,178,178,178,32,178,178,32,178,32,178,178,32,178,178,32,178,32,178,32,178,32,178,178,178,178,32,32,32,32,178,32,178,178,178,32,178,178,178,178,32,178,178,178,178,32,178,178,32,178,32,178,32,32,32,32,32,178,178,178
cad18 db 178,32,32,32,32,32,32,32,32,32,32,32,32,178,32,178,32,178,32,32,32,32,32,178,32,178,178,32,178,32,178,178,32,178,32,32,178,32,178,32,178,32,178,178,178,178,178,32,178,32,178,32,178,178,178,32,178,178,178,178,32,178,178,178,178,32,178,178,32,178,32,178,32,178,178,178,32,178,178,178
cad19 db 178,32,178,178,178,178,178,178,178,32,178,178,178,178,32,178,32,178,32,178,178,178,32,178,32,178,178,32,178,32,32,32,32,178,32,178,178,32,178,32,178,32,178,32,178,178,178,32,178,178,178,32,32,32,32,32,178,178,32,178,32,178,178,178,178,32,178,178,32,178,32,178,32,32,32,32,32,178,178,178
cad20 db 178,32,178,178,178,178,178,178,178,32,32,32,32,32,32,178,32,178,32,178,32,32,32,178,32,178,178,32,178,178,178,178,178,178,178,178,178,32,178,32,178,32,178,32,178,178,178,178,178,178,178,32,178,32,178,178,178,178,32,178,32,178,178,178,178,32,178,178,32,178,32,178,178,178,178,178,32,178,178,178
cad21 db 178,32,178,178,178,178,178,178,178,178,178,178,178,178,178,178,32,178,32,178,32,178,178,178,32,178,178,32,178,178,178,32,32,32,32,32,32,32,178,32,178,32,178,32,32,32,32,32,32,32,32,32,178,32,32,32,32,32,32,178,32,32,32,32,178,32,32,32,32,178,32,178,32,32,32,32,32,178,178,178
cad22 db 178,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,178,32,178,178,178,178,178,32,178,178,32,178,178,178,32,178,178,178,178,178,178,178,32,178,32,178,178,178,178,32,178,178,178,178,178,178,178,178,178,178,178,32,178,178,178,178,178,178,178,178,178,178,178,32,178,178,178,178,178,32,178,178,178
cad23 db 178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,32,32,32,32,32,32,32,178,178,32,32,32,32,32,32,32,32,32,32,32,32,32,178,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,178,178,178
cad24 db 178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,"$"
; Aqui termina el mapa
mono db 02h,"$" ; la carita que sera nuestro cursor
codeseg
start:
mov ax,@data
mov ds,ax
call imp
laberin:
mov ah,07h ;colocamos esta interrupciones para ver que esta ingresando desde el teclao para las tecla de direccion
int 21h
cmp al,4dh
jz aux2 ;derecha
cmp al,48h
jz arriba
cmp al,4bh
jz aux1 ; izquierda
cmp al,50h
jz abajo
jmp laberin
; Este procedimiento es para imprimir el mapa del laberinto
; y colocar el cursor donde inicia el laberinto
proc imp
mov ah, 02 ; Interrepcion para colorcar caracter
mov bh, 0 ;
mov dh, 00 ; posiciona cursor en (0,0)
mov dl, 00 ;
int 10h ;
lea dx,cad1 ; le pasamos la cad 1
mov cx,1
;Vamos a imprimir el mapa 1 ves
et1:
mov ah, 09
int 21h ; lo va imprimir hasta que encuentre un salto de linea osea hasta el final de la cad24
add dx,1
loop et1
mov ah, 02 ; }
mov bh, 0 ; }
mov dh, 11 ; } posiciona cursor Donde empieza el laberinto
mov dl, 00 ; }
int 10h ; }
lea dx,mono
mov ah,09
int 21h
mov ah, 02 ; }
mov bh, 0 ; }
mov dh, 11 ; } hago esto por que regresa el cursor dado qeu habia avansado un lugar
mov dl, 0 ; }
int 10h ; }
jmp laberin
endp imp
aux2:
jmp der
aux1:
jmp izq
;estos son los procedimientos para moverse en el laberinto
proc arriba
mov ah,03h ; vemos la poscion del cursor
int 10h
dec dh ; le quitamos un renglon
mov ah, 02 ; nos movemos a esa posiciosn
int 10h
mov ah,08h ; vemos que hay en ese pocision
int 10h
cmp al,178 ; comparamos si es una pared
jne movarr
inc dh ; si no es una pared nos regresamos a dodne estabamos
mov ah, 02
int 10h
jmp laberin
movarr:
lea dx,[mono] ; si es imprimimos el monito
mov ah, 09
int 21h
mov ah,03h ; vemos doen quedamos
int 10h
dec dl
mov ah, 02
int 10h
jmp laberin
endp arriba
proc abajo
mov ah,03h
int 10h
inc dh
mov ah, 02
int 10h
mov ah,08h
int 10h
cmp al,178
jne movaba
dec dh
mov ah, 02
int 10h
jmp laberin
movaba:
lea dx,[mono]
mov ah, 09
int 21h
mov ah,03h
int 10h
dec dl
mov ah, 02
int 10h
jmp laberin
endp abajo
proc der
mov ah,03h
int 10h
inc dl
mov ah, 02 ; }
int 10h ; }
mov ah,08h
int 10h
cmp al,234
jz adios; adios
cmp al,178
jne movder
dec dl
mov ah, 02
int 10h
jmp laberin
movder:
lea dx, [mono]
mov ah, 09
int 21h
mov ah,03h
int 10h
dec dl
mov ah, 02
int 10h
jmp laberin
adios:
mov ah,04ch
mov al,[ExCode]
int 21h
ret
endp der
proc izq
mov ah,03h
int 10h
dec dl
mov ah, 02 ; }
int 10h ; }
mov ah,08h
int 10h
cmp al,178
jne movder
inc dl
mov ah, 02
int 10h
jmp laberin
movizq:
lea dx, [mono]
mov ah, 09
int 21h
mov ah,03h
int 10h
inc dl
mov ah, 02
int 10h
jmp laberin
ret
endp izq
end start