Go to most recent revision | Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
31 | halyavin | 1 | ; |
2 | ; Stack Status Monitor |
||
3 | ; |
||
4 | ; Compile with FASM for Menuet |
||
5 | ; |
||
6 | |||
7 | use32 |
||
8 | |||
9 | org 0x0 |
||
10 | |||
11 | db 'MENUET00' ; 8 byte id |
||
12 | dd 38 ; required os |
||
13 | dd START ; program start |
||
14 | dd I_END ; program image size |
||
15 | dd 0x100000 ; required amount of memory |
||
16 | dd 0x00000000 ; reserved=no extended header |
||
17 | |||
18 | include 'lang.inc' |
||
19 | include 'macros.inc' |
||
20 | |||
21 | START: ; start of execution |
||
22 | call draw_window ; at first, draw the window |
||
23 | |||
24 | still: |
||
25 | mov eax,23 ; wait here for event |
||
26 | mov ebx,200 ; Time out after 2s |
||
27 | int 0x40 |
||
28 | |||
29 | cmp eax,1 ; redraw request ? |
||
30 | jz red |
||
31 | cmp eax,2 ; key in buffer ? |
||
32 | jz key |
||
33 | cmp eax,3 ; button in buffer ? |
||
34 | jz button |
||
35 | |||
36 | ; read the stack status data, and write it to the screen buffer |
||
37 | |||
38 | mov eax, 53 |
||
39 | mov ebx, 255 |
||
40 | mov ecx, 6 |
||
41 | int 0x40 |
||
42 | |||
43 | mov ebx, text + 24 |
||
44 | call printhex |
||
45 | |||
46 | mov eax, 53 |
||
47 | mov ebx, 255 |
||
48 | mov ecx, 2 |
||
49 | int 0x40 |
||
50 | |||
51 | mov ebx, text + 107 |
||
52 | call printhex |
||
53 | |||
54 | mov eax, 53 |
||
55 | mov ebx, 255 |
||
56 | mov ecx, 5 |
||
57 | int 0x40 |
||
58 | |||
59 | mov ebx, text + 107 + 40 |
||
60 | call printhex |
||
61 | |||
62 | mov eax, 53 |
||
63 | mov ebx, 255 |
||
64 | mov ecx, 4 |
||
65 | int 0x40 |
||
66 | |||
67 | mov ebx, text + 107 + 80 |
||
68 | call printhex |
||
69 | |||
70 | mov eax, 53 |
||
71 | mov ebx, 255 |
||
72 | mov ecx, 100 |
||
73 | int 0x40 |
||
74 | |||
75 | mov ebx, text + 258 |
||
76 | call printhex |
||
77 | |||
78 | mov eax, 53 |
||
79 | mov ebx, 255 |
||
80 | mov ecx, 101 |
||
81 | int 0x40 |
||
82 | |||
83 | mov ebx, text + 258 + 40 |
||
84 | call printhex |
||
85 | |||
86 | mov eax, 53 |
||
87 | mov ebx, 255 |
||
88 | mov ecx, 102 |
||
89 | int 0x40 |
||
90 | |||
91 | mov ebx, text + 258 + 80 |
||
92 | call printhex |
||
93 | |||
94 | mov eax, 53 |
||
95 | mov ebx, 255 |
||
96 | mov ecx, 103 |
||
97 | int 0x40 |
||
98 | |||
99 | mov ebx, text + 258 + 120 |
||
100 | call printhex |
||
101 | |||
102 | red: ; redraw |
||
103 | call draw_window |
||
104 | jmp still |
||
105 | |||
106 | key: ; Keys are not valid at this part of the |
||
107 | mov eax,2 ; loop. Just read it and ignore |
||
108 | int 0x40 |
||
109 | jmp still |
||
110 | |||
111 | button: ; button |
||
112 | mov eax,17 ; get id |
||
113 | int 0x40 |
||
114 | |||
115 | cmp ah,1 ; button id=1 ? |
||
116 | jnz still |
||
117 | |||
118 | mov eax,0xffffffff ; close this program |
||
119 | int 0x40 |
||
120 | |||
121 | jmp still |
||
122 | |||
123 | |||
124 | |||
125 | |||
126 | ; ********************************************* |
||
127 | ; ******* WINDOW DEFINITIONS AND DRAW ******** |
||
128 | ; ********************************************* |
||
129 | |||
130 | |||
131 | draw_window: |
||
132 | |||
133 | mov eax,12 ; function 12:tell os about windowdraw |
||
134 | mov ebx,1 ; 1, start of draw |
||
135 | int 0x40 |
||
136 | |||
137 | ; DRAW WINDOW |
||
138 | mov eax,0 ; function 0 : define and draw window |
||
139 | mov ebx,100*65536+260 ; [x start] *65536 + [x size] |
||
140 | mov ecx,100*65536+205 ; [y start] *65536 + [y size] |
||
141 | mov edx,0x03224466 ; color of work area RRGGBB |
||
142 | mov esi,0x00334455 ; color of grab bar RRGGBB,8->color gl |
||
143 | mov edi,0x00ddeeff ; color of frames RRGGBB |
||
144 | int 0x40 |
||
145 | |||
146 | ; WINDOW LABEL |
||
147 | mov eax,4 ; function 4 : write text to window |
||
148 | mov ebx,8*65536+8 ; [x start] *65536 + [y start] |
||
149 | mov ecx,0x00ffffff ; color of text RRGGBB |
||
150 | mov edx,labelt ; pointer to text beginning |
||
151 | mov esi,labellen-labelt ; text length |
||
152 | int 0x40 |
||
153 | |||
154 | ; Re-draw the screen text |
||
155 | cld |
||
156 | mov ebx,25*65536+35 ; draw info text with function 4 |
||
157 | mov ecx,0xffffff |
||
158 | mov edx,text |
||
159 | mov esi,40 |
||
160 | newline: |
||
161 | mov eax,4 |
||
162 | int 0x40 |
||
163 | add ebx,16 |
||
164 | add edx,40 |
||
165 | cmp [edx],byte 'x' |
||
166 | jnz newline |
||
167 | |||
168 | |||
169 | mov eax,12 ; function 12:tell os about windowdraw |
||
170 | mov ebx,2 ; 2, end of draw |
||
171 | int 0x40 |
||
172 | |||
173 | ret |
||
174 | |||
175 | ; Taken from PS.ASM |
||
176 | printhex: |
||
177 | ; number in eax |
||
178 | ; print to ebx |
||
179 | ; xlat from hextable |
||
180 | pusha |
||
181 | mov esi, ebx |
||
182 | add esi, 8 |
||
183 | mov ebx, hextable |
||
184 | mov ecx, 8 |
||
185 | phex_loop: |
||
186 | mov edx, eax |
||
187 | and eax, 15 |
||
188 | xlatb |
||
189 | mov [esi], al |
||
190 | mov eax, edx |
||
191 | shr eax, 4 |
||
192 | dec esi |
||
193 | loop phex_loop |
||
194 | popa |
||
195 | ret |
||
196 | |||
197 | |||
198 | ; DATA AREA |
||
199 | |||
200 | text: |
||
201 | db ' Ethernet card status : xxxxxxxx ' |
||
202 | db ' ' |
||
203 | db ' IP packets received : xxxxxxxx ' |
||
204 | db ' ARP packets received : xxxxxxxx ' |
||
205 | db ' Dumped received packets : xxxxxxxx ' |
||
206 | db ' ' |
||
207 | db ' EMPTY QUEUE : xxxxxxxx ' |
||
208 | db ' IPOUT QUEUE : xxxxxxxx ' |
||
209 | db ' IPIN QUEUE : xxxxxxxx ' |
||
210 | db ' NET1OUT QUEUE : xxxxxxxx ' |
||
211 | db 'x <- END MARKER, DONT DELETE ' |
||
212 | |||
213 | |||
214 | labelt: |
||
215 | db 'Stack Status' |
||
216 | labellen: |
||
217 | |||
218 | hextable db '0123456789ABCDEF' |
||
219 | |||
220 | |||
221 | I_END:-> |
||
222 |