
Programa para mover cuatro caracteres como una serpiente
Publicado por Jorge (3 intervenciones) el 08/06/2016 05:28:30
Consulta como puedo mover tres o 4 caracteres con las teclas fechas up, rigth,left,down como una serpiente
He colocado un solo carácter adjunto el programas
Favor su ayuda
He colocado un solo carácter adjunto el programas
Favor su ayuda
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
.model small
.stack 100h
.data
car DB 0
pox DB 0
poy DB 0
xa DB 0
ya DB 0
aviso DB 'Escriba un caracter y muevalo con las flechas: ','$'
.code
mov ax,@data
mov ds,ax
mov ah,02h ;
mov bh,00h
mov dh,5 ;fil
mov dl,5 ;col
int 10h
mov ah,9
mov dx,OFFSET aviso
int 21h
mov ah,01h
int 21h
mov car,al
mov ah,03h
mov bh,00h
int 10h
mov pox,ch
mov poy,dh
dec pox
mov ah,05h ; borrar pantalla
mov al,01h
int 10h
bucle:
mov ah,02h; ubicarse en la posicion anterior
mov bh,01h
mov dh,ya
mov dl,xa
int 10h
mov ah,02h ; borrar el caracter
mov dl,32 ;
int 21h
mov ah,02h; ubicar el cursor
mov bh,01h
mov dh,poy
mov dl,pox
int 10h
mov ah,02h ; imprimir el caracter
mov dl,car
int 21h
mov ah,02h ; colocar el cursor en su posicion anterior
mov bh,01h
mov dh,poy
mov dl,pox
int 10h
mov xa,dl
mov ya,dh
mov ah,00h
int 16h ; interrup de teclado
cmp ah,75
jnz noleft
dec pox
jmp bucle
noleft:
cmp ah,72
jnz nodown
dec poy
jmp bucle
nodown:
cmp ah,77
jnz noright
inc pox
jmp bucle
noright:
cmp ah,80
jnz noup
inc poy
jmp bucle
noup:
cmp al,27
jz fin
jmp bucle
fin:
mov ah,4ch
mov al,00h
int 21h
END
Valora esta pregunta


0