-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfruta.asm
93 lines (75 loc) · 2.91 KB
/
fruta.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
; UNIVERSIDAD DE SAN CARLOS DE GUATEMALA
; FACULTAD DE INGENIERIA
; ARQUITECTURA DE COMPUTADORES Y ENSAMBLADORES 1
; PRIMER SEMESTRE
; SECCION B
; HERBERTH GUILLERMO OBREGÓNN ESPINO - 201314237
; NASM
;
; Comando para ensamblar: #nasm fruta.asm -o fruta.com
; Presionar tecla para finalizar
;======================================================================|
; M A I N |
;======================================================================|
ORG 100h
mov ah,00h ;modo video
mov al,13h ;320x200 256 colores
int 10h ;servicio de pantalla
call Put_Fruit ;pintar ejes
call GetCh2 ;leer caracter
mov ah,00h ;modo video
mov al,03h ;80x25 16 colores
int 10h ;servicio de pantalla
mov ah, 4ch ; funcion 4C, finalizar ejecucion
int 21h ; interrupcion DOS
;======================================================================
; funcion Put_Fruit
; coloca la fruta
Put_Fruit:
mov es, word[startaddr] ;colocar direccion de segmento de video en ES
;f(158,98) = x + y*320
mov di, 31360 ;y*320 = 98*320 = 31360
add di, 158 ;sumar x
mov si, fruta1 ;colocar direccion de dato source
mov cx, 5 ;tamaño del dato a mover
cld ;clear direction flag (direccion en que se copian los datos)
rep movsb ;mover dato
mov si, fruta2 ;colocar direccion de dato source
add di, 315 ;cambiar de fila
mov cx, 5 ;tamaño del dato a mover
cld ;clear direction flag (direccion en que se copian los datos)
rep movsb ;mover dato
mov si, fruta3 ;colocar direccion de dato source
add di, 315 ;cambiar de fila
mov cx, 5 ;tamaño del dato a mover
cld ;clear direction flag (direccion en que se copian los datos)
rep movsb ;mover dato
mov si, fruta4 ;colocar direccion de dato source
add di, 315 ;cambiar de fila
mov cx, 5 ;tamaño del dato a mover
cld ;clear direction flag (direccion en que se copian los datos)
rep movsb ;mover dato
mov si, fruta5 ;colocar direccion de dato source
add di, 315 ;cambiar de fila
mov cx, 5 ;tamaño del dato a mover
cld ;clear direction flag (direccion en que se copian los datos)
rep movsb ;mover dato
ret
;======================================================================
; funcion GetCh2
; ascii tecla presionada
GetCh2:
mov ah,08h ; funcion 8, capturar caracter sin mostrarlo
int 21h ; interrupcion DOS
ret ; return
;======================================================================|
; D A T A |
;======================================================================|
SEGMENT data
startaddr dw 0A000h ;inicio del segmento de memoria de video
;fruta
fruta1 DB 00, 00, 10, 00, 00
fruta2 DB 00, 04, 04, 04, 00
fruta3 DB 04, 04, 04, 04, 04
fruta4 DB 00, 04, 04, 04, 00
fruta5 DB 00, 00, 04, 00, 00