Subversion Repositories Kolibri OS

Rev

Rev 320 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

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