Ensamblador - Que hace este programa?

 
Vista:

Que hace este programa?

Publicado por Harry (2 intervenciones) el 07/04/2014 19:05:09
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
; mouse test
 
name "mouse"
 
org 100h
 
print macro x, y, attrib, sdat
LOCAL   s_dcl, skip_dcl, s_dcl_end
    pusha
    mov dx, cs
    mov es, dx
    mov ah, 13h
    mov al, 1
    mov bh, 0
    mov bl, attrib
    mov cx, offset s_dcl_end - offset s_dcl
    mov dl, x
    mov dh, y
    mov bp, offset s_dcl
    int 10h
    popa
    jmp skip_dcl
    s_dcl DB sdat
    s_dcl_end DB 0
    skip_dcl:
endm
 
clear_screen macro
    pusha
    mov ax, 0600h
    mov bh, 0000_1111b
    mov cx, 0
    mov dh, 24
    mov dl, 79
    int 10h
    popa
endm
 
print_space macro num
    pusha
    mov ah, 9
    mov al, ' '
    mov bl, 0000_1111b
    mov cx, num
    int 10h
    popa
endm
 
 
jmp start
 
curX dw 0
curY dw 0
curB dw 0
 
 
start:
mov ax, 1003h ; disable blinking.
mov bx, 0
int 10h
 
; hide text cursor:
mov ch, 32
mov ah, 1
int 10h
 
 
; reset mouse and get its status:
mov ax, 0
int 33h
cmp ax, 0
jne ok
print 1,1,0010_1111b, " mouse not found :-( "
jmp stop
 
ok:
clear_screen
 
print 7,7,0010_1011b," note: in the emulator you may need to press and hold mouse buttons "
print 7,8,0010_1011b," because mouse interrupts are not processed in real time.           "
print 7,9,0010_1011b," for a real test, click external->run from the menu.                "
print 10,11,0010_1111b," click/hold both buttons to exit... "
 
; display mouse cursor:
mov ax, 1
int 33h
 
check_mouse_buttons:
mov ax, 3
int 33h
cmp bx, 3  ; both buttons
je  hide
cmp cx, curX
jne print_xy
cmp dx, curY
jne print_xy
cmp bx, curB
jne print_buttons
 
 
print_xy:
print 0,0,0000_1111b,"x="
mov ax, cx
call print_ax
print_space 4
print 0,1,0000_1111b,"y="
mov ax, dx
call print_ax
print_space 4
mov curX, cx
mov curY, dx
jmp check_mouse_buttons
 
print_buttons:
print 0,2,0000_1111b,"btn="
mov ax, bx
call print_ax
print_space 4
mov curB, bx
jmp check_mouse_buttons
 
 
 
hide:
mov ax, 2  ; hide mouse cursor.
int 33h
 
clear_screen
 
print 1,1,1010_0000b," hardware must be free!      free the mice! "
 
stop:
; show box-shaped blinking text cursor:
mov ah, 1
mov ch, 0
mov cl, 8
int 10h
 
print 4,7,0000_1010b," press any key.... "
mov ah, 0
int 16h
 
ret
 
 
print_ax proc
cmp ax, 0
jne print_ax_r
    push ax
    mov al, '0'
    mov ah, 0eh
    int 10h
    pop ax
    ret
print_ax_r:
    pusha
    mov dx, 0
    cmp ax, 0
    je pn_done
    mov bx, 10
    div bx
    call print_ax_r
    mov ax, dx
    add al, 30h
    mov ah, 0eh
    int 10h
    jmp pn_done
pn_done:
    popa
    ret
endp

Gracias de antemano y si me podrian ayudar a documentar se los agradeceria! :)
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
1
Responder

Que hace este programa?

Publicado por MSH (120 intervenciones) el 07/04/2014 20:55:46
Es un código sencillo donde te muestra las coordenadas de la posición del cursor mouse en pantalla
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
1
Comentar

Que hace este programa?

Publicado por Harry (2 intervenciones) el 07/04/2014 21:21:37
Gracias, podrias ayudarme con algo de documentacion, es que soy nuevo en el tema y me interesa mucho aprender
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar

Que hace este programa?

Publicado por Dino Oportus (2 intervenciones) el 07/11/2014 05:50:18
Hola MHL, tengo un proyecto en este lenguaje y me gustaría retribuir tu ayuda, en caso que pudieras brindarla. Esta mi correo a la vista, en caso que te interese. Saludos
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar