Subversion Repositories Kolibri OS

Rev

Rev 320 | Go to most recent revision | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 320 Rev 451
1
; optimize the code for size
1
; optimize the code for size
2
macro add arg1,arg2
2
macro add arg1,arg2
3
 {
3
 {
4
   if arg1 in 
4
   if arg1 in 
5
      if arg2 eqtype 0
5
      if arg2 eqtype 0
6
	 if arg2 = 1
6
	 if arg2 = 1
7
	    inc arg1
7
	    inc arg1
8
	 else
8
	 else
9
	    add arg1,arg2
9
	    add arg1,arg2
10
	 end if
10
	 end if
11
      else
11
      else
12
	 add arg1,arg2
12
	 add arg1,arg2
13
      end if
13
      end if
14
   else
14
   else
15
      add arg1,arg2
15
      add arg1,arg2
16
   end if
16
   end if
17
 }
17
 }
18
 
18
 
19
macro sub arg1,arg2
19
macro sub arg1,arg2
20
 {
20
 {
21
   if arg2 eqtype 0
21
   if arg2 eqtype 0
22
      if arg2 = 1
22
      if arg2 = 1
23
	 dec arg1
23
	 dec arg1
24
      else
24
      else
25
	 sub arg1,arg2
25
	 sub arg1,arg2
26
      end if
26
      end if
27
   else
27
   else
28
      sub arg1,arg2
28
      sub arg1,arg2
29
   end if
29
   end if
30
 }
30
 }
31
 
31
 
32
macro mov arg1,arg2
32
macro mov arg1,arg2
33
 {
33
 {
34
   if arg1 in 
34
   if arg1 in 
35
      if arg2 eqtype 0
35
      if arg2 eqtype 0
36
	 if arg2 = 0
36
	 if arg2 = 0
37
	    xor arg1,arg1
37
	    xor arg1,arg1
38
	 else if arg2 = 1
38
	 else if arg2 = 1
39
	    xor arg1,arg1
39
	    xor arg1,arg1
40
	    inc arg1
40
	    inc arg1
41
	 else if arg2 = -1
41
	 else if arg2 = -1
42
	    or	arg1,-1
42
	    or	arg1,-1
43
	 else if arg2 > -128 & arg2 < 128
43
	 else if arg2 > -128 & arg2 < 128
44
	    push arg2
44
	    push arg2
45
	    pop  arg1
45
	    pop  arg1
46
	 else
46
	 else
47
	    mov  arg1,arg2
47
	    mov  arg1,arg2
48
	 end if
48
	 end if
49
      else
49
      else
50
	 mov arg1,arg2
50
	 mov arg1,arg2
51
      end if
51
      end if
52
   else
52
   else
53
      mov arg1,arg2
53
      mov arg1,arg2
54
   end if
54
   end if
55
 }
55
 }
56
 
56
 
57
 
57
 
58
; Interface
58
; Interface
59
 
59
 
60
macro Window xStart,yStart,xSize,ySize,bColor,gColor,fColor
60
macro Window xStart,yStart,xSize,ySize,bColor,gColor,fColor
61
{
61
{
62
 mov ebx,xStart
62
 mov ebx,xStart
63
 shl ebx,16
63
 shl ebx,16
64
 add ebx,xSize
64
 add ebx,xSize
65
 mov ecx,yStart
65
 mov ecx,yStart
66
 shl ecx,16
66
 shl ecx,16
67
 add ecx,ySize
67
 add ecx,ySize
68
 mov edx,bColor
68
 mov edx,bColor
69
 mov esi,gColor
69
 mov esi,gColor
70
 mov edi,fColor
70
 mov edi,fColor
71
 xor eax,eax
71
 xor eax,eax
72
 int 0x40
72
 int 0x40
73
}
73
}
74
 
74
 
75
 
75
 
76
;WriteTextToWindow
76
;WriteTextToWindow
77
macro Text xStart,yStart,rgbColor,pText,nTextLen
77
macro Text xStart,yStart,rgbColor,pText,nTextLen
78
{
78
{
79
 mov ebx,xStart
79
 mov ebx,xStart
80
 shl ebx,16
80
 shl ebx,16
81
 add ebx,yStart
81
 add ebx,yStart
82
 mov ecx,rgbColor
82
 mov ecx,rgbColor
83
 mov edx,pText
83
 mov edx,pText
84
 mov esi,nTextLen
84
 mov esi,nTextLen
85
 mov eax,4
85
 mov eax,4
86
 int 0x40
86
 int 0x40
87
}
87
}
88
 
88
 
89
;DisplayNumber
89
;DisplayNumber
90
macro Number xStart,yStart,nPrintType,noOfDigits,Data,rgbColor
90
macro Number xStart,yStart,nPrintType,noOfDigits,Data,rgbColor
91
{
91
{
92
 
92
 
93
 mov edx,xStart
93
 mov edx,xStart
94
 shl edx,16
94
 shl edx,16
95
 add edx,yStart
95
 add edx,yStart
96
 mov ebx,noOfDigits
96
 mov ebx,noOfDigits
97
 shl ebx,16
97
 shl ebx,16
98
 or ebx,nPrintType
98
 or ebx,nPrintType
99
 mov ecx,Data
99
 mov ecx,Data
100
 mov esi,rgbColor
100
 mov esi,rgbColor
101
 mov eax,47
101
 mov eax,47
102
 int 0x40
102
 int 0x40
103
}
103
}
104
 
104
 
105
macro DrawLine xStart,xEnd,yStart,yEnd,rgbColor
105
macro DrawLine xStart,xEnd,yStart,yEnd,rgbColor
106
{
106
{
107
 mov ebx,xStart
107
 mov ebx,xStart
108
 shl ebx,16
108
 shl ebx,16
109
 add ebx,xEnd
109
 add ebx,xEnd
110
 mov ecx,yStart
110
 mov ecx,yStart
111
 shl ecx,16
111
 shl ecx,16
112
 add ecx, yEnd
112
 add ecx, yEnd
113
 mov edx,rgbColor
113
 mov edx,rgbColor
114
 mov eax,38
114
 mov eax,38
115
 int 0x40
115
 int 0x40
116
}
116
}
117
 
117
 
118
macro PutImage xPos,yPos,xImage,yImage,pImage
118
macro PutImage xPos,yPos,xImage,yImage,pImage
119
{
119
{
120
 mov ecx,xImage
120
 mov ecx,xImage
121
 shl ecx,16
121
 shl ecx,16
122
 add ecx, yImage
122
 add ecx, yImage
123
 mov edx,xPos
123
 mov edx,xPos
124
 shl edx,16
124
 shl edx,16
125
 add edx,yPos
125
 add edx,yPos
126
 mov ebx,pImage
126
 mov ebx,pImage
127
 mov eax,7
127
 mov eax,7
128
 int 0x40
128
 int 0x40
129
}
129
}
130
 
130
 
131
macro Button xStart,yStart,xSize,ySize,nID,rgbColor
131
macro Button xStart,yStart,xSize,ySize,nID,rgbColor
132
{
132
{
133
 mov ebx,xStart
133
 mov ebx,xStart
134
 shl ebx,16
134
 shl ebx,16
135
 add ebx,xSize
135
 add ebx,xSize
136
 mov ecx,yStart
136
 mov ecx,yStart
137
 shl ecx,16
137
 shl ecx,16
138
 add ecx,ySize
138
 add ecx,ySize
139
 mov edx,nID
139
 mov edx,nID
140
 mov esi,rgbColor
140
 mov esi,rgbColor
141
 mov eax,8
141
 mov eax,8
142
 int 0x40
142
 int 0x40
143
}
143
}
144
 
144
 
145
macro CreateTread EntryPoint,StackPos
145
macro CreateTread EntryPoint,StackPos
146
{
146
{
147
 xor ebx,ebx
147
 xor ebx,ebx
148
 inc ebx
148
 inc ebx
149
 mov ecx,EntryPoint
149
 mov ecx,EntryPoint
150
 mov edx,StackPos
150
 mov edx,StackPos
151
 mov eax,51
151
 mov eax,51
152
 int 0x40
152
 int 0x40
153
}
153
}
154
 
154
 
155
 
155
 
156
;//////////////////////////////////////////////
156
;//////////////////////////////////////////////
157
;Decoding Brand ID for Intel
157
;Decoding Brand ID for Intel
158
 
158
 
159
 
159
 
160
 
160
 
161
decodebrand:
161
decodebrand:
162
 
162
 
163
 
163
 
164
cmp dword[smallvendor], 'cAMD'
164
cmp dword[smallvendor], 'cAMD'
165
jz amd_br
165
jz amd_br
166
cmp dword[smallvendor], 'ntel'
166
cmp dword[smallvendor], 'ntel'
167
jz intel_br
167
jz intel_br
168
jmp Bi00   ; if not AMD or Intel
168
jmp Bi00   ; if not AMD or Intel
169
 
169
 
170
amd_br:      ;;;;;;;;;;;;;;;;;;;;; amd brand
170
amd_br:      ;;;;;;;;;;;;;;;;;;;;; amd brand
171
 
171
 
172
xor eax,eax
172
xor eax,eax
173
inc eax
173
inc eax
174
cpuid
174
cpuid
175
 
175
 
176
cnnn0:
176
cnnn0:
177
cmp bl, 00h
177
cmp bl, 00h
178
ja rr
178
ja rr
179
je cnnn1
179
je cnnn1
180
 
180
 
181
rr:
181
rr:
182
mov byte [brand], bl ;
182
mov byte [brand], bl ;
183
Text 275,210,0x00000000,abrand00, abrand00len-abrand00
183
Text 270,190,0x00000000,abrand00, abrand00len-abrand00
184
jmp B000
184
jmp B000
185
;jmp comppp
185
;jmp comppp
186
 
186
 
187
cnnn1:
187
cnnn1:
188
 
188
 
189
mov	eax, 0x80000001 	      ; CPUID ext. function 0x80000001
189
mov	eax, 0x80000001 	      ; CPUID ext. function 0x80000001
190
cpuid
190
cpuid
191
 
191
 
192
cmp ebx, 0
192
cmp ebx, 0
193
je Bi00
193
je Bi00
194
mov word [brand], bx ;
194
mov word [brand], bx ;
195
 
195
 
196
comppp:
196
comppp:
197
cmp  [brand], 400h
197
cmp  [brand], 400h
198
jl res1
198
jl res1
199
cmp  [brand], 500h
199
cmp  [brand], 500h
200
jl res2
200
jl res2
201
jae res3
201
jae res3
202
 
202
 
203
 
203
 
204
res1:
204
res1:
205
Text 275,210,0x00000000,abrand0, abrand0len-abrand0
205
Text 270,190,0x00000000,abrand0, abrand0len-abrand0
206
jmp B000
206
jmp B000
207
 
207
 
208
res2:
208
res2:
209
Text 275,210,0x00000000,abrand1, abrand1len-abrand1
209
Text 270,190,0x00000000,abrand1, abrand1len-abrand1
210
jmp B000
210
jmp B000
211
 
211
 
212
res3:
212
res3:
213
Text 275,210,0x00000000,abrand2, abrand2len-abrand2
213
Text 270,190,0x00000000,abrand2, abrand2len-abrand2
214
jmp B000
214
jmp B000
215
	     ;;;;;;;;;;;;;;;;;;;;; intel brand
215
	     ;;;;;;;;;;;;;;;;;;;;; intel brand
216
intel_br:
216
intel_br:
217
      xor eax,eax
217
      xor eax,eax
218
      inc eax
218
      inc eax
219
      cpuid
219
      cpuid
220
cmp0:
220
cmp0:
221
cmp bl, 00h
221
cmp bl, 00h
222
je Bi00
222
je Bi00
223
 
223
 
224
cmp1:
224
cmp1:
225
cmp bl, 01h
225
cmp bl, 01h
226
je Bi01
226
je Bi01
227
 
227
 
228
cmp2:
228
cmp2:
229
cmp bl, 02h
229
cmp bl, 02h
230
je Bi02
230
je Bi02
231
 
231
 
232
cmp3:
232
cmp3:
233
cmp bl, 03h
233
cmp bl, 03h
234
je Bi03
234
je Bi03
235
 
235
 
236
cmp4:
236
cmp4:
237
cmp bl, 04h
237
cmp bl, 04h
238
je Bi04
238
je Bi04
239
 
239
 
240
cmp6:
240
cmp6:
241
cmp bl, 06h
241
cmp bl, 06h
242
je Bi06
242
je Bi06
243
 
243
 
244
cmp7:
244
cmp7:
245
cmp bl, 07h
245
cmp bl, 07h
246
je Bi07
246
je Bi07
247
 
247
 
248
cmp8:
248
cmp8:
249
cmp bl, 08h
249
cmp bl, 08h
250
je Bi08
250
je Bi08
251
 
251
 
252
cmp9:
252
cmp9:
253
cmp bl, 09h
253
cmp bl, 09h
254
je Bi09
254
je Bi09
255
 
255
 
256
cmpA:
256
cmpA:
257
cmp bl, 0Ah
257
cmp bl, 0Ah
258
je Bi0A
258
je Bi0A
259
 
259
 
260
cmpB:
260
cmpB:
261
cmp bl, 0Bh
261
cmp bl, 0Bh
262
je Bi0B
262
je Bi0B
263
 
263
 
264
cmpC:
264
cmpC:
265
cmp bl, 0Ch
265
cmp bl, 0Ch
266
je Bi0C
266
je Bi0C
267
 
267
 
268
cmpE:
268
cmpE:
269
cmp bl, 0Eh
269
cmp bl, 0Eh
270
je Bi0E
270
je Bi0E
271
 
271
 
272
cmpF:
272
cmpF:
273
cmp bl, 0Fh
273
cmp bl, 0Fh
274
je Bi0F
274
je Bi0F
275
 
275
 
276
cmp11:
276
cmp11:
277
cmp bl, 11h
277
cmp bl, 11h
278
je Bi11
278
je Bi11
279
 
279
 
280
cmp12:
280
cmp12:
281
cmp bl, 12h
281
cmp bl, 12h
282
je Bi12
282
je Bi12
283
 
283
 
284
cmp13:
284
cmp13:
285
cmp bl, 13h
285
cmp bl, 13h
286
je Bi13
286
je Bi13
287
 
287
 
288
cmp14:
288
cmp14:
289
cmp bl, 14h
289
cmp bl, 14h
290
je Bi14
290
je Bi14
291
 
291
 
292
cmp15:
292
cmp15:
293
cmp bl, 15h
293
cmp bl, 15h
294
je Bi15
294
je Bi15
295
 
295
 
296
cmp16:
296
cmp16:
297
cmp bl, 16h
297
cmp bl, 16h
298
je Bi16
298
je Bi16
299
 
299
 
300
cmp17:
300
cmp17:
301
cmp bl, 17h
301
cmp bl, 17h
302
je Bi17
302
je Bi17
303
 
303
 
304
jne Bi00
304
jne Bi00
305
 
305
 
306
;------------------
306
;------------------
307
Bi00:
307
Bi00:
308
mov byte [brand], bl ;00h
308
mov byte [brand], bl ;00h
309
Text 65,270,0x00000000,brand0, brand0len-brand0
309
Text 60,250,0x00000000,brand0, brand0len-brand0
310
;Number 275,200,1*256,2,dword [brand],0x000000     was in v. 1.11
310
;Number 270,180,1*256,2,dword [brand],0x000000     was in v. 1.11
311
jmp B000
311
jmp B000
312
 
312
 
313
Bi01:
313
Bi01:
314
mov [brand], 01h
314
mov [brand], 01h
315
Text 65,270,0x00000000,brand01, brand01len-brand01
315
Text 60,250,0x00000000,brand01, brand01len-brand01
316
jmp B000
316
jmp B000
317
 
317
 
318
Bi02:
318
Bi02:
319
mov [brand], 02h
319
mov [brand], 02h
320
Text 65,270,0x00000000,brand02, brand02len-brand02
320
Text 60,250,0x00000000,brand02, brand02len-brand02
321
jmp B000
321
jmp B000
322
 
322
 
323
Bi03:
323
Bi03:
324
mov [brand], 03h
324
mov [brand], 03h
325
 
325
 
326
cmp [m], 8
326
cmp [m], 8
327
je E3
327
je E3
328
Text 65,270,0x00000000,brand03, brand03len-brand03
328
Text 60,250,0x00000000,brand03, brand03len-brand03
329
jmp B000
329
jmp B000
330
E3:
330
E3:
331
Text 65,270,0x00000000,brand03d, brand03dlen-brand03d
331
Text 60,250,0x00000000,brand03d, brand03dlen-brand03d
332
jmp B000
332
jmp B000
333
 
333
 
334
Bi04:
334
Bi04:
335
mov [brand], 04h
335
mov [brand], 04h
336
Text 65,270,0x00000000,brand04, brand04len-brand04
336
Text 60,250,0x00000000,brand04, brand04len-brand04
337
jmp B000
337
jmp B000
338
 
338
 
339
Bi06:
339
Bi06:
340
mov [brand], 06h
340
mov [brand], 06h
341
Text 65,270,0x00000000,brand06, brand06len-brand06
341
Text 60,250,0x00000000,brand06, brand06len-brand06
342
jmp B000
342
jmp B000
343
 
343
 
344
Bi07:
344
Bi07:
345
mov [brand], 07h
345
mov [brand], 07h
346
Text 65,270,0x00000000,brand07, brand07len-brand07
346
Text 60,250,0x00000000,brand07, brand07len-brand07
347
jmp B000
347
jmp B000
348
 
348
 
349
Bi08:
349
Bi08:
350
mov [brand], 08h
350
mov [brand], 08h
351
Text 65,270,0x00000000,brand08, brand08len-brand08
351
Text 60,250,0x00000000,brand08, brand08len-brand08
352
jmp B000
352
jmp B000
353
 
353
 
354
Bi09:
354
Bi09:
355
mov [brand], 09h
355
mov [brand], 09h
356
Text 65,270,0x00000000,brand09, brand09len-brand09
356
Text 60,250,0x00000000,brand09, brand09len-brand09
357
jmp B000
357
jmp B000
358
 
358
 
359
Bi0A:
359
Bi0A:
360
mov [brand], 0Ah
360
mov [brand], 0Ah
361
Text 65,270,0x00000000,brand0A, brand0Alen-brand0A
361
Text 60,250,0x00000000,brand0A, brand0Alen-brand0A
362
jmp B000
362
jmp B000
363
 
363
 
364
Bi0B:
364
Bi0B:
365
mov [brand], 0Bh
365
mov [brand], 0Bh
366
 
366
 
367
cmp [m], 13
367
cmp [m], 13
368
jl Eb
368
jl Eb
369
Text 65,270,0x00000000,brand0B, brand0Blen-brand0B
369
Text 60,250,0x00000000,brand0B, brand0Blen-brand0B
370
jmp B000
370
jmp B000
371
Eb:
371
Eb:
372
Text 65,270,0x00000000,brand0Bd, brand0Bdlen-brand0Bd
372
Text 60,250,0x00000000,brand0Bd, brand0Bdlen-brand0Bd
373
jmp B000
373
jmp B000
374
 
374
 
375
Bi0C:
375
Bi0C:
376
mov [brand], 0Ch
376
mov [brand], 0Ch
377
Text 65,270,0x00000000,brand0C, brand0Clen-brand0C
377
Text 60,250,0x00000000,brand0C, brand0Clen-brand0C
378
jmp B000
378
jmp B000
379
 
379
 
380
Bi0E:
380
Bi0E:
381
mov [brand], 0Eh
381
mov [brand], 0Eh
382
 
382
 
383
cmp [m], 13
383
cmp [m], 13
384
jl Ed
384
jl Ed
385
Text 65,270,0x00000000,brand0E, brand0Elen-brand0E
385
Text 60,250,0x00000000,brand0E, brand0Elen-brand0E
386
jmp B000
386
jmp B000
387
Ed:
387
Ed:
388
Text 65,270,0x00000000,brand0Ed, brand0Edlen-brand0Ed
388
Text 60,250,0x00000000,brand0Ed, brand0Edlen-brand0Ed
389
jmp B000
389
jmp B000
390
 
390
 
391
Bi0F:
391
Bi0F:
392
mov [brand], 0Fh
392
mov [brand], 0Fh
393
Text 65,270,0x00000000,brand0F, brand0Flen-brand0F
393
Text 60,250,0x00000000,brand0F, brand0Flen-brand0F
394
jmp B000
394
jmp B000
395
 
395
 
396
Bi11:
396
Bi11:
397
mov [brand], 11h
397
mov [brand], 11h
398
Text 65,270,0x00000000,brand11, brand11len-brand11
398
Text 60,250,0x00000000,brand11, brand11len-brand11
399
jmp B000
399
jmp B000
400
 
400
 
401
Bi12:
401
Bi12:
402
mov [brand], 12h
402
mov [brand], 12h
403
Text 65,270,0x00000000,brand12, brand12len-brand12
403
Text 60,250,0x00000000,brand12, brand12len-brand12
404
jmp B000
404
jmp B000
405
 
405
 
406
Bi13:
406
Bi13:
407
mov [brand], 13h
407
mov [brand], 13h
408
Text 65,270,0x00000000,brand13, brand13len-brand13
408
Text 60,250,0x00000000,brand13, brand13len-brand13
409
jmp B000
409
jmp B000
410
 
410
 
411
Bi14:
411
Bi14:
412
mov [brand], 14h
412
mov [brand], 14h
413
Text 65,270,0x00000000,brand14, brand14len-brand14
413
Text 60,250,0x00000000,brand14, brand14len-brand14
414
jmp B000
414
jmp B000
415
 
415
 
416
Bi15:
416
Bi15:
417
mov [brand], 15h
417
mov [brand], 15h
418
Text 65,270,0x00000000,brand15, brand15len-brand15
418
Text 60,250,0x00000000,brand15, brand15len-brand15
419
jmp B000
419
jmp B000
420
 
420
 
421
Bi16:
421
Bi16:
422
mov [brand], 16h
422
mov [brand], 16h
423
Text 65,270,0x00000000,brand16, brand16len-brand16
423
Text 60,250,0x00000000,brand16, brand16len-brand16
424
jmp B000
424
jmp B000
425
 
425
 
426
Bi17:
426
Bi17:
427
mov [brand], 17h
427
mov [brand], 17h
428
Text 65,270,0x00000000,brand17, brand17len-brand17
428
Text 60,250,0x00000000,brand17, brand17len-brand17
429
jmp B000
429
jmp B000
430
 
430
 
431
B000:
431
B000:
432
 
432
 
433
ret
433
ret