Subversion Repositories Kolibri OS

Rev

Rev 223 | Go to most recent revision | Blame | Last modification | View Log | Download | RSS feed

  1. ; optimize the code for size
  2. macro add arg1,arg2
  3.  {
  4.    if arg1 in <eax,ebx,ecx,edx,esi,edi,ebp,esp>
  5.       if arg2 eqtype 0
  6.          if arg2 = 1
  7.             inc arg1
  8.          else
  9.             add arg1,arg2
  10.          end if
  11.       else
  12.          add arg1,arg2
  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
  23.          dec arg1
  24.       else
  25.          sub arg1,arg2
  26.       end if
  27.    else
  28.       sub arg1,arg2
  29.    end if
  30.  }
  31.  
  32. macro mov arg1,arg2
  33.  {
  34.    if arg1 in <eax,ebx,ecx,edx,esi,edi,ebp,esp>
  35.       if arg2 eqtype 0
  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
  49.       else
  50.          mov arg1,arg2
  51.       end if
  52.    else
  53.       mov arg1,arg2
  54.    end if
  55.  }
  56.  
  57.  
  58. ; Interface
  59.  
  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.  
  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. {
  92.  
  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.  
  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. }
  130.  
  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. }
  144.  
  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. }
  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 ;
  183. Text 275,210,0x00000000,abrand00, abrand00len-abrand00
  184. jmp B000
  185. ;jmp comppp
  186.  
  187. cnnn1:
  188.  
  189. mov     eax, 0x80000001               ; CPUID ext. function 0x80000001
  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:
  205. Text 275,210,0x00000000,abrand0, abrand0len-abrand0
  206. jmp B000
  207.  
  208. res2:
  209. Text 275,210,0x00000000,abrand1, abrand1len-abrand1
  210. jmp B000
  211.  
  212. res3:
  213. Text 275,210,0x00000000,abrand2, abrand2len-abrand2
  214. jmp B000
  215.              ;;;;;;;;;;;;;;;;;;;;; intel brand
  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
  309. Text 65,270,0x00000000,brand0, brand0len-brand0
  310. ;Number 275,200,1*256,2,dword [brand],0x000000     was in v. 1.11
  311. jmp B000
  312.  
  313. Bi01:
  314. mov [brand], 01h
  315. Text 65,270,0x00000000,brand01, brand01len-brand01
  316. jmp B000
  317.  
  318. Bi02:
  319. mov [brand], 02h
  320. Text 65,270,0x00000000,brand02, brand02len-brand02
  321. jmp B000
  322.  
  323. Bi03:
  324. mov [brand], 03h
  325.  
  326. cmp [m], 8
  327. je E3
  328. Text 65,270,0x00000000,brand03, brand03len-brand03
  329. jmp B000
  330. E3:
  331. Text 65,270,0x00000000,brand03d, brand03dlen-brand03d
  332. jmp B000
  333.  
  334. Bi04:
  335. mov [brand], 04h
  336. Text 65,270,0x00000000,brand04, brand04len-brand04
  337. jmp B000
  338.  
  339. Bi06:
  340. mov [brand], 06h
  341. Text 65,270,0x00000000,brand06, brand06len-brand06
  342. jmp B000
  343.  
  344. Bi07:
  345. mov [brand], 07h
  346. Text 65,270,0x00000000,brand07, brand07len-brand07
  347. jmp B000
  348.  
  349. Bi08:
  350. mov [brand], 08h
  351. Text 65,270,0x00000000,brand08, brand08len-brand08
  352. jmp B000
  353.  
  354. Bi09:
  355. mov [brand], 09h
  356. Text 65,270,0x00000000,brand09, brand09len-brand09
  357. jmp B000
  358.  
  359. Bi0A:
  360. mov [brand], 0Ah
  361. Text 65,270,0x00000000,brand0A, brand0Alen-brand0A
  362. jmp B000
  363.  
  364. Bi0B:
  365. mov [brand], 0Bh
  366.  
  367. cmp [m], 13
  368. jl Eb
  369. Text 65,270,0x00000000,brand0B, brand0Blen-brand0B
  370. jmp B000
  371. Eb:
  372. Text 65,270,0x00000000,brand0Bd, brand0Bdlen-brand0Bd
  373. jmp B000
  374.  
  375. Bi0C:
  376. mov [brand], 0Ch
  377. Text 65,270,0x00000000,brand0C, brand0Clen-brand0C
  378. jmp B000
  379.  
  380. Bi0E:
  381. mov [brand], 0Eh
  382.  
  383. cmp [m], 13
  384. jl Ed
  385. Text 65,270,0x00000000,brand0E, brand0Elen-brand0E
  386. jmp B000
  387. Ed:
  388. Text 65,270,0x00000000,brand0Ed, brand0Edlen-brand0Ed
  389. jmp B000
  390.  
  391. Bi0F:
  392. mov [brand], 0Fh
  393. Text 65,270,0x00000000,brand0F, brand0Flen-brand0F
  394. jmp B000
  395.  
  396. Bi11:
  397. mov [brand], 11h
  398. Text 65,270,0x00000000,brand11, brand11len-brand11
  399. jmp B000
  400.  
  401. Bi12:
  402. mov [brand], 12h
  403. Text 65,270,0x00000000,brand12, brand12len-brand12
  404. jmp B000
  405.  
  406. Bi13:
  407. mov [brand], 13h
  408. Text 65,270,0x00000000,brand13, brand13len-brand13
  409. jmp B000
  410.  
  411. Bi14:
  412. mov [brand], 14h
  413. Text 65,270,0x00000000,brand14, brand14len-brand14
  414. jmp B000
  415.  
  416. Bi15:
  417. mov [brand], 15h
  418. Text 65,270,0x00000000,brand15, brand15len-brand15
  419. jmp B000
  420.  
  421. Bi16:
  422. mov [brand], 16h
  423. Text 65,270,0x00000000,brand16, brand16len-brand16
  424. jmp B000
  425.  
  426. Bi17:
  427. mov [brand], 17h
  428. Text 65,270,0x00000000,brand17, brand17len-brand17
  429. jmp B000
  430.  
  431. B000:
  432.  
  433. ret