-
Notifications
You must be signed in to change notification settings - Fork 0
/
rescal.asm
330 lines (278 loc) · 9.85 KB
/
rescal.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
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
;/////////////////////////////////////////
;AUTOR: CRISTIAN FELIPE RUBIO AGUIAR
; INGENIERIA ELECTRONICA
;/////////////////////////////////////////
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
clear2_screen macro
pusha
mov ax, 0600h
mov bh, 1111_0001b
mov cx, 0
mov dh, 24
mov dl, 79
int 10h
popa
endm
data segment
texto DB 64H DUP (?) ;Variable (texto) de 100 (64H)
data ends
code segment
assume cs:code, ds:data
main proc far
push ds
xor ax,ax
push ax
mov ax,data ;Mueve data a ax
mov ds,ax ;Mueve ...
lea si,texto ;Carga la variable (texto) en si
RESISTOR:
print 1,3,0011_0000b, " "
print 1,4,0011_0000b, " Calculadora de Colores de resistencias V_1.0 alpha "
print 1,5,0011_0000b, " "
print 1,9,0000_1111b, " 101010 010101 010101 101010"
print 1,10,0000_1111b, " 101010 010101 010101 101010"
print 1,11,0000_1111b, " 101010 010101/10101 010101 10101/010101 101010"
print 1,12,0000_1111b, " 101010 010101/10101 010101 10101/010101 101010"
print 1,13,0000_1111b, " //////////// 101010 010101/10101 010101 10101/010101 101010 ////////////"
print 1,14,0000_1111b, " //////////// 101010 010101/10101 010101 10101/010101 101010 ////////////"
print 1,15,0000_1111b, " 101010 010101/10101 010101 10101/010101 101010"
print 1,16,0000_1111b, " 101010 010101/10101 010101 10101/010101 101010"
print 1,17,0000_1111b, " 101010 010101 010101 101010"
print 1,18,0000_1111b, " 101010 010101 010101 101010"
print 1,21,0000_1111b, " Presione una tecla para continuar..."
mov ah,01h ;Lee el caracter de entrada y lo envia a la salida
int 21h
clear2_screen
jmp LOGO
LOGO:
print 8,1,0011_0000b, " Universidad de Ibague"
print 14,4,1111_0001b, " 0101"
print 14,5,1111_0001b, " 010101"
print 14,6,1111_0001b, " 01010101"
print 14,7,1111_0001b, " 01010101"
print 14,8,1111_0001b, " 010101"
print 14,9,1111_0001b, " 101 0101 101"
print 15,10,1111_0001b, " 10101 10101"
print 15,11,1111_0001b, " 1010101 0101 1010101"
print 15,12,1111_0001b, " 1010101 010101 1010101"
print 15,13,1111_0001b, " 1010101 101010 1010101"
print 15,14,1111_0001b, " 1010101 010101 1010101"
print 15,15,1111_0001b, " 1010101 10101010 1010101"
print 15,16,1111_0001b, " 1010101 01010101 1010101"
print 15,17,1111_0001b, " 1010101 1010101010 1010101"
print 15,18,1111_0001b, " 01010101 1010101010 10101010"
print 15,19,1111_0001b, " 101010101 101010101"
print 15,20,1111_0001b, " 1010101010101010101010101010101010"
print 15,21,1111_0001b, " 101010101010101010101010101010101"
print 15,22,1111_0001b, " 01010101010101010101010101010"
jmp RETARDO
;***************************************************************
;* CX es la palabra de orden superior del conteo. Por ejemplo, *
;* si CX es 98h y DX es 9680h, un retraso de 10 segundos *
;***************************************************************
RETARDO:
mov ah,86h
mov cx, 10h ;Tiempo en microsegundos
mov dx, 2030h
int 15h
clear_screen
jmp INICIO
INICIO:
clear_screen
print 1,1,1110_0000b, " Valores comerciales de resistencias de cuatro (4) bandas: "
print 1,2,0000_0000b, " "
print 1,3,0011_0000b, " a = 1 ohm "
print 1,4,0011_0000b, " b = 10 ohm "
print 1,5,0011_0000b, " c = 15 ohm "
print 1,6,0011_0000b, " d = 22 ohm "
print 1,7,0011_0000b, " e = 27 ohm "
print 1,8,0011_0000b, " f = 33 ohm "
print 1,9,0011_0000b, " g = 39 ohm "
print 1,10,0011_0000b, " h = 47 ohm "
print 1,11,0011_0000b, " i = 56 ohm "
print 1,12,0011_0000b, " j = 68 ohm "
print 1,13,0011_0000b, " k = 75 ohm "
print 1,14,0011_0000b, " l = 82 ohm "
print 1,15,0011_0000b, " m = 100 ohm "
print 1,16,0011_0000b, " n = 120 ohm "
print 1,17,0011_0000b, " o = 150 ohm "
print 1,18,0011_0000b, " p = 180 ohm "
print 1,19,0011_0000b, " r = 220 ohm "
print 1,20,0011_0000b, " s = 270 ohm "
print 1,21,0011_0000b, " t = 330 ohm "
print 1,22,0011_0000b, " u = 390 ohm "
print 1,23,0011_0000b, " v = 470 ohm "
print 1,24,0011_0000b, " w = 510 ohm "
print 15,2,0000_0000b, " "
print 15,3,0011_0000b, " x = 680 ohm "
print 15,4,0011_0000b, " y = 820 ohm "
print 15,5,0011_0000b, " z = 1K ohm "
print 15,6,0011_0000b, " A = 3K ohm "
print 15,7,0011_0000b, " B = 10K ohm "
print 15,8,0011_0000b, " C = 15K ohm "
print 63,24,0000_1111b, " @cristianrubio "
print 15,16,0000_1111b, "* Para saber el codigo de colores del valor"
print 15,17,0000_1111b, " Ingrese el caracter."
print 16,18,0000_1111b, " "
COMPARADOR:
mov ah,01h
int 21h
cmp al,61h ;Se compara con a
jb COMPARADOR ;Si es menor salta a "INICIO"
cmp al,7ah ;Se compara z
ja COMPARADOR ;Si es mayor salta a "INICIO"
cmp al,0dh ;Se compara con enter
je ETIQUETA ;Si es igual salta a "ETIQUETA"
cmp al,73h
je SALIR
cmp al,61h
je 1_OHM
cmp al,62h
je 10_OHM
cmp al,63h
je 15_OHM
cmp al,64h
je 22_OHM
1_OHM:
print 46,8,0110_0000b, " marron "
print 46,9,0000_1111b, " negro "
print 46,10,1110_0000b, " dorado "
print 46,11,1110_0000b, " dorado "
print 16,18,0000_1111b, " "
mov ah,01h
int 21h
cmp al,73h
je SALIR
10_OHM:
print 46,8,0110_0000b, " marron "
print 46,9,0000_1111b, " negro "
print 46,10,0000_1111b, " negro "
print 46,11,1110_0000b, " dorado "
print 16,18,0000_1111b, " "
mov ah,01h
int 21h
cmp al,73h
je SALIR
15_OHM:
print 46,8,0110_0000b, " marron "
print 46,9,0010_0000b, " verde "
print 46,10,0000_1111b, " negro "
print 46,11,1110_0000b, " dorado "
print 16,18,0000_1111b, " "
mov ah,01h
int 21h
cmp al,73h
je SALIR
22_OHM:
print 46,8,0100_0000b, " rojo "
print 46,9,0100_0000b, " rojo "
print 46,10,0000_1111b, " negro "
print 46,11,1110_0000b, " dorado "
print 16,18,0000_1111b, " "
mov ah,01h
int 21h
cmp al,73h
je SALIR
27_OHM:
print 46,8,0100_0000b, " rojo "
print 46,9,0101_0000b, "violeta "
print 46,10,0000_1111b, " negro "
print 46,11,1110_0000b, " dorado "
print 16,18,0000_1111b, " "
mov ah,01h
int 21h
cmp al,73h
je SALIR
33_OHM:
print 46,8,1100_0000b, " naranja"
print 46,9,1100_0000b, " naranja"
print 46,10,0000_1111b, " negro "
print 46,11,1110_0000b, " dorado "
print 16,18,0000_1111b, " "
mov ah,01h
int 21h
cmp al,73h
je SALIR
39_OHM:
print 46,8,1100_0000b, " naranja"
print 46,9,1111_0000b, " blanco "
print 46,10,0000_1111b, " negro "
print 46,11,1110_0000b, " dorado "
print 16,18,0000_1111b, " "
mov ah,01h
int 21h
cmp al,73h
je SALIR
ETIQUETA:
cmp si,00 ;Se compara si con zero para saber "Si esta vacia"
je COMPARADOR ;Si es igual a zero salta a la "INICIO"
;"Si no esta vacia (basura)"
mov al,'$' ;Se asigna el caracter del fin de la cadena a "al"
VISUALIZAR:
mov ah,09h ;Visualizo la cadena de caracteres en mayusculas
lea dx,texto ;dx=segmento
int 21h
SALIR:
clear_screen
print 29,10,1110_0000b, "Abandonar el programa"
print 5,13,0000_1111b, " Presione (s) para confirmar y/o (n) para cancelar: "
mov ah,01h
int 21h
cmp al,73h
je LOGOFIN
cmp al,6eh
je INICIO
LOGOFIN:
clear_screen
print 15,5,0000_0000b, " 010101101010101 010101010101"
print 15,6,0000_1111b, " 010101101010101 01010101010101"
print 15,7,0000_1111b, " 010101101010101 010101010101010"
print 15,8,0000_1111b, " 010101101010101 01010 0101"
print 15,9,0000_1111b, " 010101 01010 0101"
print 16,10,0000_1111b, " 010101 01010 0101"
print 16,11,0000_1111b, " 010101 01010101010101"
print 16,12,0000_1111b, " 010101 0101010101010"
print 16,13,0000_1111b, " 010101 01010101010"
print 16,14,0000_1111b, " 010101 01010 0101010"
print 16,15,0000_1111b, " 010101 01010 101010"
print 16,16,0000_1111b, " 010101101010101 01010 101010"
print 16,17,0000_1111b, " 010101101010101 01010 101010"
print 16,18,0000_1111b, " 010101101010101 01010 101010"
FIN:
mov ah,07h
int 21h
mov ah,4ch
int 21h
main endp
code ends
end main
end