-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathreporte.asm
159 lines (147 loc) · 3.82 KB
/
reporte.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
createReport macro
getDate
getTime
createFile repAddr, handler
writeFile handler, header, [SIZEOF header - 1]
writeFile handler, date, SIZEOF date
writeFile handler, time, SIZEOF time
writeFile handler, repMsg1, SIZEOF repMsg1
seekEnd handler
;-----------Funcion original--------------
writeFile handler, repMsg2, SIZEOF repMsg2
writeFunction ;print function
;-----------Funcion derivada--------------
writeFile handler, repMsg3, SIZEOF repMsg3
writeDerived ;print derived
;-----------Funcion integral--------------
writeFile handler, repMsg4, SIZEOF repMsg4
writeIntegral ;print integral
closeFile handler
endm
writeFunction macro
writeFile handler, fx, [SIZEOF fx - 1]
seekEnd handler
writeCoefficients 1
writeFile handler, newLine, [SIZEOF newLine - 1]
seekEnd handler
writeFile handler, newLine, [SIZEOF newLine - 1]
seekEnd handler
endm
writeDerived macro
writeFile handler, fx, [SIZEOF fx - 1]
writeCoefficients 2
writeFile handler, newLine, [SIZEOF newLine - 1]
writeFile handler, newLine, [SIZEOF newLine - 1]
endm
writeIntegral macro
writeFile handler, fx, [SIZEOF fx - 1]
writeCoefficients 3
writeFile handler, newLine, [SIZEOF newLine - 1]
writeFile handler, newLine, [SIZEOF newLine - 1]
endm
writeCoefficients macro type
LOCAL normal, derived, integral, finish
mov bl, type
cmp bl, 1
je normal
cmp bl, 2
je derived
jmp integral
normal:
writeCoefficient c4, 52
writeCoefficient c3, 51
writeCoefficient c2, 50
writeCoefficient c1, 49
writeCoefficient c0, 48
jmp finish
derived:
writeCoefficientD d3, 51
writeCoefficientD d2, 50
writeCoefficientD d1, 49
writeCoefficientD d0, 48
jmp finish
integral:
writeCoefficientI i5, 53
writeCoefficientI i4, 52
writeCoefficientI i3, 51
writeCoefficientI i2, 50
writeCoefficientI i1, 49
writeFile handler, constantI, 5
finish:
endm
writeCoefficient macro coefficient, var
LOCAL finish
cmp coefficient[1], 0
je finish
writeSign coefficient[0]
xor dx, dx
mov dl, coefficient[1]
convertAscii dx,auxCo
writeFile handler, auxCo, [SIZEOF auxCo - 1]
writeVariable var
finish:
endm
writeCoefficientD macro coefficient, var
LOCAL finish, print2
cmp coefficient[1], 0
je finish
writeSign coefficient[0]
xor dx, dx
mov dl, coefficient[1]
convertAscii dx,deriv
cmp coefficient[1], 9
jg print2
writeFile handler, deriv, 1
jmp finish
print2:
writeFile handler, deriv, 2
finish:
writeVariable var
endm
writeCoefficientI macro coefficient, var
LOCAL possibleF, finish, normal
mov bl, var
cmp bl, 49
jg possibleF
normal:
writeCoefficient coefficient, var
jmp finish
possibleF:
cmp coefficient[2], 0
je normal
writeSign coefficient[0]
xor dx, dx
mov dl, coefficient[1]
convertAscii dx,deriv
writeFile handler, deriv, 1
writeFile handler, fraction, 1
xor dx, dx
mov dl, coefficient[2]
convertAscii dx,deriv
writeFile handler, deriv, 1
cleanBuffer deriv, SIZEOF deriv, 24h
writeFile handler, space, 1
writeVariable var
finish:
endm
writeSign macro char
LOCAL printPlus, printMinus, finish
cmp char, 43
je printPlus
jmp printMinus
printPlus:
writeFile handler, plus, [SIZEOF plus - 1]
jmp finish
printMinus:
writeFile handler, minus, [SIZEOF minus - 1]
finish:
endm
writeVariable macro num
LOCAL finish
mov bl, num
cmp bl, 48
je finish
mov varX[1], num
writeFile handler, varX, [SIZEOF varX - 1]
finish:
endm