Rev 485 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
205 | heavyiron | 1 | ; |
2 | ; CPU SPEED INDICATIOR |
||
3 | ; |
||
4 | ; Compile with FASM for Menuet |
||
5 | ; |
||
6 | |||
7 | use32 |
||
8 | org 0x0 |
||
9 | |||
872 | heavyiron | 10 | db 'MENUET01' ; 8 byte id |
11 | dd 0x01 ; header version |
||
12 | dd START ; start of code |
||
13 | dd I_END ; size of image |
||
14 | dd 0x1000 ; memory for app |
||
15 | dd 0x1000 ; esp |
||
16 | dd 0x0,0x0 ; I_Param , I_Icon |
||
205 | heavyiron | 17 | |
18 | include 'lang.inc' |
||
485 | heavyiron | 19 | include '..\..\..\..\macros.inc' |
205 | heavyiron | 20 | |
21 | START: ; start of execution |
||
22 | |||
23 | mov eax,18 |
||
24 | mov ebx,5 |
||
485 | heavyiron | 25 | mcall |
205 | heavyiron | 26 | |
27 | xor edx,edx |
||
28 | mov ebx,1000000 |
||
29 | div ebx |
||
30 | mov ebx,10 |
||
31 | mov edi,text+19 |
||
32 | mov ecx,5 |
||
33 | newnum: |
||
34 | xor edx,edx |
||
35 | mov ebx,10 |
||
36 | div ebx |
||
37 | add dl,48 |
||
38 | mov [edi],dl |
||
39 | sub edi,1 |
||
40 | loop newnum |
||
485 | heavyiron | 41 | |
42 | mov eax,48 |
||
43 | mov ebx,3 |
||
44 | mov ecx,sc |
||
45 | mov edx,sizeof.system_colors |
||
46 | mcall |
||
47 | |||
317 | heavyiron | 48 | red: |
205 | heavyiron | 49 | call draw_window ; at first, draw the window |
50 | |||
51 | still: |
||
52 | |||
53 | mov eax,10 ; wait here for event |
||
485 | heavyiron | 54 | mcall |
205 | heavyiron | 55 | |
56 | cmp eax,1 ; redraw request ? |
||
57 | jz red |
||
58 | cmp eax,2 ; key in buffer ? |
||
59 | jz key |
||
60 | cmp eax,3 ; button in buffer ? |
||
61 | jz button |
||
62 | |||
63 | jmp still |
||
64 | |||
65 | key: ; key |
||
66 | mov eax,2 ; just read it and ignore |
||
485 | heavyiron | 67 | mcall |
205 | heavyiron | 68 | jmp still |
69 | |||
70 | button: ; button |
||
71 | mov eax,17 ; get id |
||
485 | heavyiron | 72 | mcall |
205 | heavyiron | 73 | |
74 | cmp ah,1 ; button id=1 ? |
||
75 | jnz still |
||
317 | heavyiron | 76 | or eax,-1 ; close this program |
485 | heavyiron | 77 | mcall |
205 | heavyiron | 78 | |
79 | |||
80 | ; ********************************************* |
||
81 | ; ******* WINDOW DEFINITIONS AND DRAW ******** |
||
82 | ; ********************************************* |
||
83 | |||
84 | |||
85 | draw_window: |
||
86 | |||
87 | mov eax,12 ; function 12:tell os about windowdraw |
||
88 | mov ebx,1 ; 1, start of draw |
||
485 | heavyiron | 89 | mcall |
205 | heavyiron | 90 | |
91 | ; DRAW WINDOW |
||
92 | mov eax,0 ; function 0 : define and draw window |
||
93 | mov ebx,100*65536+200 ; [x start] *65536 + [x size] |
||
94 | mov ecx,100*65536+65 ; [y start] *65536 + [y size] |
||
95 | mov edx,[sc.work] ; color of work area RRGGBB,8->color glide |
||
317 | heavyiron | 96 | or edx,0x33000000 ; color of grab bar RRGGBB,8->color |
485 | heavyiron | 97 | mov edi,title ; WINDOW LABEL |
98 | mcall |
||
205 | heavyiron | 99 | |
100 | |||
317 | heavyiron | 101 | mov ebx,20*65536+14 ; draw info text with function 4 |
205 | heavyiron | 102 | mov ecx,[sc.work_text] |
103 | mov edx,text |
||
317 | heavyiron | 104 | mov esi,24 |
205 | heavyiron | 105 | mov eax,4 |
485 | heavyiron | 106 | mcall |
317 | heavyiron | 107 | |
205 | heavyiron | 108 | mov eax,12 ; function 12:tell os about windowdraw |
109 | mov ebx,2 ; 2, end of draw |
||
485 | heavyiron | 110 | mcall |
205 | heavyiron | 111 | |
112 | ret |
||
113 | |||
114 | |||
115 | ; DATA AREA |
||
116 | |||
117 | |||
118 | text: |
||
317 | heavyiron | 119 | db 'CPU RUNNING AT MHZ' |
205 | heavyiron | 120 | |
485 | heavyiron | 121 | title db 'CPU SPEED',0 |
205 | heavyiron | 122 | |
123 | I_END: |
||
124 | |||
125 | sc system_colors |
||
126 |