Rev 6609 | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 6609 | Rev 6610 | ||
---|---|---|---|
1 | ; This program shows information about thread ; |
1 | ; This program shows information about thread ; |
2 | ; usage: tinfo [slot of the thread] ; |
2 | ; usage: tinfo [slot of the thread] ; |
3 | ; if slot number is omitted then assume slot = -1 ; |
3 | ; if slot number is omitted then assume slot = -1 ; |
4 | ; to compile: nasm -f bin tinfo.asm -o tinfo ; |
4 | ; to compile: nasm -f bin tinfo.asm -o tinfo ; |
5 | ORG 0 |
5 | ORG 0 |
6 | BITS 32 |
6 | BITS 32 |
7 | ; ---------------------------------------------------------------------------- ; |
7 | ; ---------------------------------------------------------------------------- ; |
8 | PATH_SIZE equ 1024 |
8 | PATH_SIZE equ 1024 |
9 | PARAMS_SIZE equ 256 |
9 | PARAMS_SIZE equ 256 |
10 | STACK_SIZE equ 256 |
10 | STACK_SIZE equ 256 |
11 | PROC_INFO_SIZE equ 1024 |
11 | PROC_INFO_SIZE equ 1024 |
12 | TMP_BUFFER_SIZE equ 64 |
12 | TMP_BUFFER_SIZE equ 64 |
13 | ; ---------------------------------------------------------------------------- ; |
13 | ; ---------------------------------------------------------------------------- ; |
14 | TEXT_WIDTH equ 8 |
14 | TEXT_WIDTH equ 8 |
15 | BOLD_TEXT_WIDTH equ TEXT_WIDTH + 1 |
15 | BOLD_TEXT_WIDTH equ TEXT_WIDTH + 1 |
16 | ; ---------------------------------------------------------------------------- ; |
16 | ; ---------------------------------------------------------------------------- ; |
17 | COLUMN1_MAX_COUNT equ 13 |
17 | COLUMN1_MAX_COUNT equ 13 |
18 | COLUMN2_MAX_COUNT equ 12 |
18 | COLUMN2_MAX_COUNT equ 12 |
19 | COLUMN3_MAX_COUNT equ 26 |
19 | COLUMN3_MAX_COUNT equ 26 |
20 | ; ---------------------------------------------------------------------------- ; |
20 | ; ---------------------------------------------------------------------------- ; |
21 | COLUMN_PADDING equ 3 |
21 | COLUMN_PADDING equ 3 |
22 | COLUMN1_PADDING equ COLUMN_PADDING |
22 | COLUMN1_PADDING equ COLUMN_PADDING |
23 | COLUMN2_PADDING equ COLUMN_PADDING |
23 | COLUMN2_PADDING equ COLUMN_PADDING |
24 | COLUMN3_PADDING equ COLUMN_PADDING |
24 | COLUMN3_PADDING equ COLUMN_PADDING |
25 | ; ---------------------------------------------------------------------------- ; |
25 | ; ---------------------------------------------------------------------------- ; |
26 | ITEM_HEIGHT equ 22 |
26 | ITEM_HEIGHT equ 22 |
27 | TEXT_HEIGHT equ 16 |
27 | TEXT_HEIGHT equ 16 |
28 | %comment |
28 | %IF 0 |
29 | COLUMN1_ITEM_WIDTH equ COLUMN1_MAX_COUNT * BOLD_TEXT_WIDTH + COLUMN1_PADDING * 2 |
29 | COLUMN1_ITEM_WIDTH equ COLUMN1_MAX_COUNT * BOLD_TEXT_WIDTH + COLUMN1_PADDING * 2 |
30 | COLUMN2_ITEM_WIDTH equ COLUMN2_MAX_COUNT * BOLD_TEXT_WIDTH + COLUMN2_PADDING * 2 |
30 | COLUMN2_ITEM_WIDTH equ COLUMN2_MAX_COUNT * BOLD_TEXT_WIDTH + COLUMN2_PADDING * 2 |
31 | COLUMN3_ITEM_WIDTH equ COLUMN3_MAX_COUNT * BOLD_TEXT_WIDTH + COLUMN3_PADDING * 2 |
31 | COLUMN3_ITEM_WIDTH equ COLUMN3_MAX_COUNT * BOLD_TEXT_WIDTH + COLUMN3_PADDING * 2 |
32 | %endcomment |
32 | %ENDIF |
33 | COLUMN1_ITEM_WIDTH equ COLUMN1_MAX_COUNT * TEXT_WIDTH + COLUMN1_PADDING * 2 |
33 | COLUMN1_ITEM_WIDTH equ COLUMN1_MAX_COUNT * TEXT_WIDTH + COLUMN1_PADDING * 2 |
34 | COLUMN2_ITEM_WIDTH equ COLUMN2_MAX_COUNT * TEXT_WIDTH + COLUMN2_PADDING * 2 |
34 | COLUMN2_ITEM_WIDTH equ COLUMN2_MAX_COUNT * TEXT_WIDTH + COLUMN2_PADDING * 2 |
35 | COLUMN3_ITEM_WIDTH equ COLUMN3_MAX_COUNT * TEXT_WIDTH + COLUMN3_PADDING * 2 |
35 | COLUMN3_ITEM_WIDTH equ COLUMN3_MAX_COUNT * TEXT_WIDTH + COLUMN3_PADDING * 2 |
36 | ITEM_MARGIN equ 6 |
36 | ITEM_MARGIN equ 6 |
37 | ITEM_BACK_COLOR_1 equ 0x00EAEAEA |
37 | ITEM_BACK_COLOR_1 equ 0x00EAEAEA |
38 | ITEM_BACK_COLOR_2 equ 0x00F4F4F4 |
38 | ITEM_BACK_COLOR_2 equ 0x00F4F4F4 |
39 | ITEM_COUNT equ 18 ; at current time we have 18 items |
39 | ITEM_COUNT equ 18 ; at current time we have 18 items |
40 | ; ---------------------------------------------------------------------------- ; |
40 | ; ---------------------------------------------------------------------------- ; |
41 | COLUMN_Y equ 10 |
41 | COLUMN_Y equ 10 |
42 | COLUMN1_X equ 10 |
42 | COLUMN1_X equ 10 |
43 | COLUMN2_X equ COLUMN1_X + COLUMN1_ITEM_WIDTH + ITEM_MARGIN |
43 | COLUMN2_X equ COLUMN1_X + COLUMN1_ITEM_WIDTH + ITEM_MARGIN |
44 | COLUMN3_X equ COLUMN2_X + COLUMN2_ITEM_WIDTH + ITEM_MARGIN |
44 | COLUMN3_X equ COLUMN2_X + COLUMN2_ITEM_WIDTH + ITEM_MARGIN |
45 | ; ---------------------------------------------------------------------------- ; |
45 | ; ---------------------------------------------------------------------------- ; |
46 | COLUMN1_TEXT_X equ COLUMN1_X + COLUMN1_PADDING |
46 | COLUMN1_TEXT_X equ COLUMN1_X + COLUMN1_PADDING |
47 | COLUMN2_TEXT_X equ COLUMN2_X + COLUMN2_PADDING |
47 | COLUMN2_TEXT_X equ COLUMN2_X + COLUMN2_PADDING |
48 | COLUMN3_TEXT_X equ COLUMN3_X + COLUMN3_PADDING |
48 | COLUMN3_TEXT_X equ COLUMN3_X + COLUMN3_PADDING |
49 | ; ---------------------------------------------------------------------------- ; |
49 | ; ---------------------------------------------------------------------------- ; |
50 | FRAME_TOP equ COLUMN_Y - ITEM_MARGIN / 2 |
50 | FRAME_TOP equ COLUMN_Y - ITEM_MARGIN / 2 |
51 | FRAME_BOTTOM equ COLUMN_Y + ITEM_HEIGHT * ITEM_COUNT + ITEM_MARGIN / 2 - 1 |
51 | FRAME_BOTTOM equ COLUMN_Y + ITEM_HEIGHT * ITEM_COUNT + ITEM_MARGIN / 2 - 1 |
52 | ; ---------------------------------------------------------------------------- ; |
52 | ; ---------------------------------------------------------------------------- ; |
53 | FRAME1_LEFT equ COLUMN1_X - ITEM_MARGIN / 2 |
53 | FRAME1_LEFT equ COLUMN1_X - ITEM_MARGIN / 2 |
54 | FRAME1_RIGHT equ COLUMN1_X + COLUMN1_ITEM_WIDTH + ITEM_MARGIN / 2 - 1 |
54 | FRAME1_RIGHT equ COLUMN1_X + COLUMN1_ITEM_WIDTH + ITEM_MARGIN / 2 - 1 |
55 | ; ---------------------------------------------------------------------------- ; |
55 | ; ---------------------------------------------------------------------------- ; |
56 | FRAME2_LEFT equ COLUMN2_X - ITEM_MARGIN / 2 |
56 | FRAME2_LEFT equ COLUMN2_X - ITEM_MARGIN / 2 |
57 | FRAME2_RIGHT equ COLUMN2_X + COLUMN2_ITEM_WIDTH + ITEM_MARGIN / 2 - 1 |
57 | FRAME2_RIGHT equ COLUMN2_X + COLUMN2_ITEM_WIDTH + ITEM_MARGIN / 2 - 1 |
58 | ; ---------------------------------------------------------------------------- ; |
58 | ; ---------------------------------------------------------------------------- ; |
59 | FRAME3_LEFT equ COLUMN3_X - ITEM_MARGIN / 2 |
59 | FRAME3_LEFT equ COLUMN3_X - ITEM_MARGIN / 2 |
60 | FRAME3_RIGHT equ COLUMN3_X + COLUMN3_ITEM_WIDTH + ITEM_MARGIN / 2 - 1 |
60 | FRAME3_RIGHT equ COLUMN3_X + COLUMN3_ITEM_WIDTH + ITEM_MARGIN / 2 - 1 |
61 | ; ---------------------------------------------------------------------------- ; |
61 | ; ---------------------------------------------------------------------------- ; |
62 | WINDOW_STYLE_SKINNED_FIXED equ 0x4000000 |
62 | WINDOW_STYLE_SKINNED_FIXED equ 0x4000000 |
63 | WINDOW_STYLE_COORD_CLIENT equ 0x20000000 |
63 | WINDOW_STYLE_COORD_CLIENT equ 0x20000000 |
64 | WINDOW_STYLE_CAPTION equ 0x10000000 |
64 | WINDOW_STYLE_CAPTION equ 0x10000000 |
65 | ; ---------------------------------------------------------------------------- ; |
65 | ; ---------------------------------------------------------------------------- ; |
66 | WINDOW_BORDER_SIZE equ 5 |
66 | WINDOW_BORDER_SIZE equ 5 |
67 | WINDOW_WIDTH equ FRAME3_RIGHT + FRAME1_LEFT + WINDOW_BORDER_SIZE * 2 |
67 | WINDOW_WIDTH equ FRAME3_RIGHT + FRAME1_LEFT + WINDOW_BORDER_SIZE * 2 |
68 | WINDOW_STYLE equ WINDOW_STYLE_SKINNED_FIXED | WINDOW_STYLE_COORD_CLIENT | WINDOW_STYLE_CAPTION |
68 | WINDOW_STYLE equ WINDOW_STYLE_SKINNED_FIXED | WINDOW_STYLE_COORD_CLIENT | WINDOW_STYLE_CAPTION |
69 | WINDOW_BACK_COLOR equ 0x00FFFFFF |
69 | WINDOW_BACK_COLOR equ 0x00FFFFFF |
70 | ; ---------------------------------------------------------------------------- ; |
70 | ; ---------------------------------------------------------------------------- ; |
71 | INDICATOR_WIDTH equ 3 |
71 | INDICATOR_WIDTH equ 3 |
72 | INDICATOR_HEIGHT equ 3 |
72 | INDICATOR_HEIGHT equ 3 |
73 | INDICATOR_LEFT equ COLUMN3_X + COLUMN3_ITEM_WIDTH + ITEM_MARGIN / 2 |
73 | INDICATOR_LEFT equ COLUMN3_X + COLUMN3_ITEM_WIDTH + ITEM_MARGIN / 2 |
74 | INDICATOR_TOP equ COLUMN_Y - ITEM_MARGIN / 2 - INDICATOR_HEIGHT |
74 | INDICATOR_TOP equ COLUMN_Y - ITEM_MARGIN / 2 - INDICATOR_HEIGHT |
75 | ; ---------------------------------------------------------------------------- ; |
75 | ; ---------------------------------------------------------------------------- ; |
76 | UPDATE_TIME equ 28 |
76 | UPDATE_TIME equ 28 |
77 | ; ---------------------------------------------------------------------------- ; |
77 | ; ---------------------------------------------------------------------------- ; |
78 | thread_info equ END + PATH_SIZE + PARAMS_SIZE |
78 | thread_info equ END + PATH_SIZE + PARAMS_SIZE |
79 | tmpbuffer equ END + PATH_SIZE + PARAMS_SIZE + PROC_INFO_SIZE |
79 | tmpbuffer equ END + PATH_SIZE + PARAMS_SIZE + PROC_INFO_SIZE |
80 | ; ---------------------------------------------------------------------------- ; |
80 | ; ---------------------------------------------------------------------------- ; |
81 | KEYBOARD_MODE_ASCII equ 0 |
81 | KEYBOARD_MODE_ASCII equ 0 |
82 | KEYBOARD_MODE_SCAN equ 1 |
82 | KEYBOARD_MODE_SCAN equ 1 |
83 | ; ---------------------------------------------------------------------------- ; |
83 | ; ---------------------------------------------------------------------------- ; |
84 | WINDOW_STATE_MAXIMIZED equ 1 |
84 | WINDOW_STATE_MAXIMIZED equ 1 |
85 | WINDOW_STATE_MINIMIZED equ 2 |
85 | WINDOW_STATE_MINIMIZED equ 2 |
86 | WINDOW_STATE_ROLLED_UP equ 4 |
86 | WINDOW_STATE_ROLLED_UP equ 4 |
87 | ; ---------------------------------------------------------------------------- ; |
87 | ; ---------------------------------------------------------------------------- ; |
88 | THREAD_STATE_RUNNING equ 0 |
88 | THREAD_STATE_RUNNING equ 0 |
89 | THREAD_STATE_SUSPENDED equ 1 |
89 | THREAD_STATE_SUSPENDED equ 1 |
90 | THREAD_STATE_SUSPENDED_WAIT_EVENT equ 2 |
90 | THREAD_STATE_SUSPENDED_WAIT_EVENT equ 2 |
91 | THREAD_STATE_NORMAL_TERMINATING equ 3 |
91 | THREAD_STATE_NORMAL_TERMINATING equ 3 |
92 | THREAD_STATE_EXCEPT_TERMINATING equ 4 |
92 | THREAD_STATE_EXCEPT_TERMINATING equ 4 |
93 | THREAD_STATE_WAIT_EVENT equ 5 |
93 | THREAD_STATE_WAIT_EVENT equ 5 |
94 | THREAD_STATE_SLOT_IS_FREE equ 9 |
94 | THREAD_STATE_SLOT_IS_FREE equ 9 |
95 | ; ---------------------------------------------------------------------------- ; |
95 | ; ---------------------------------------------------------------------------- ; |
96 | EM_REDRAW equ 1b |
96 | EM_REDRAW equ 1b |
97 | EM_KEY equ 10b |
97 | EM_KEY equ 10b |
98 | EM_BUTTON equ 100b |
98 | EM_BUTTON equ 100b |
99 | EM_RESERVED0 equ 1000b |
99 | EM_RESERVED0 equ 1000b |
100 | EM_REDRAW_BACKGROUND equ 10000b |
100 | EM_REDRAW_BACKGROUND equ 10000b |
101 | EM_MOUSE equ 100000b |
101 | EM_MOUSE equ 100000b |
102 | EM_IPC equ 1000000b |
102 | EM_IPC equ 1000000b |
103 | EM_NETWORK equ 10000000b |
103 | EM_NETWORK equ 10000000b |
104 | EM_DEBUG equ 100000000b |
104 | EM_DEBUG equ 100000000b |
105 | ; ---------------------------------------------------------------------------- ; |
105 | ; ---------------------------------------------------------------------------- ; |
106 | struc THREAD_INFO |
106 | struc THREAD_INFO |
107 | .cpu_usage resd 1 ; usage of the processor |
107 | .cpu_usage resd 1 ; usage of the processor |
108 | .win_stack_pos resw 1 ; position of the window of thread in the window stack |
108 | .win_stack_pos resw 1 ; position of the window of thread in the window stack |
109 | .reserved0 resw 1 ; has no relation to the specified thread |
109 | .reserved0 resw 1 ; has no relation to the specified thread |
110 | .reserved1 resw 1 ; reserved |
110 | .reserved1 resw 1 ; reserved |
111 | .name resb 11 ; name of the started file - executable file without extension |
111 | .name resb 11 ; name of the started file - executable file without extension |
112 | .reserved2 resb 1 ; reserved, this byte is not changed |
112 | .reserved2 resb 1 ; reserved, this byte is not changed |
113 | .mem_address resd 1 ; address of the process in memory |
113 | .mem_address resd 1 ; address of the process in memory |
114 | .mem_usage resd 1 ; size of used memory - 1 |
114 | .mem_usage resd 1 ; size of used memory - 1 |
115 | .identifier resd 1 ; identifier (PID/TID) |
115 | .identifier resd 1 ; identifier (PID/TID) |
116 | .x resd 1 ; coordinate of the thread window on axis x |
116 | .x resd 1 ; coordinate of the thread window on axis x |
117 | .y resd 1 ; coordinate of the thread window on axis y |
117 | .y resd 1 ; coordinate of the thread window on axis y |
118 | .size_x resd 1 ; size of the thread window on axis x |
118 | .size_x resd 1 ; size of the thread window on axis x |
119 | .size_y resd 1 ; size of the thread window on axis y |
119 | .size_y resd 1 ; size of the thread window on axis y |
120 | .thread_state resw 1 ; status of the thread slot |
120 | .thread_state resw 1 ; status of the thread slot |
121 | .reserved3 resw 1 ; reserved, this word is not changed |
121 | .reserved3 resw 1 ; reserved, this word is not changed |
122 | .client_x resd 1 ; coordinate of the client area on axis x |
122 | .client_x resd 1 ; coordinate of the client area on axis x |
123 | .client_y resd 1 ; coordinate of the client area on axis y |
123 | .client_y resd 1 ; coordinate of the client area on axis y |
124 | .client_size_x resd 1 ; width of the client area |
124 | .client_size_x resd 1 ; width of the client area |
125 | .client_size_y resd 1 ; height of the client area |
125 | .client_size_y resd 1 ; height of the client area |
126 | .window_state resb 1 ; state of the window - bitfield |
126 | .window_state resb 1 ; state of the window - bitfield |
127 | .event_mask resd 1 ; event mask |
127 | .event_mask resd 1 ; event mask |
128 | .keyboard_mode resb 1 ; keyboard mode |
128 | .keyboard_mode resb 1 ; keyboard mode |
129 | endstruc |
129 | endstruc |
130 | ; ---------------------------------------------------------------------------- ; |
130 | ; ---------------------------------------------------------------------------- ; |
131 | MENUET01 db 'MENUET01' |
131 | MENUET01 db 'MENUET01' |
132 | version dd 1 |
132 | version dd 1 |
133 | program.start dd START |
133 | program.start dd START |
134 | program.end dd END |
134 | program.end dd END |
135 | program.memory dd END + PATH_SIZE + PARAMS_SIZE + PROC_INFO_SIZE + TMP_BUFFER_SIZE + STACK_SIZE |
135 | program.memory dd END + PATH_SIZE + PARAMS_SIZE + PROC_INFO_SIZE + TMP_BUFFER_SIZE + STACK_SIZE |
136 | program.stack dd END + PATH_SIZE + PARAMS_SIZE + PROC_INFO_SIZE + TMP_BUFFER_SIZE + STACK_SIZE |
136 | program.stack dd END + PATH_SIZE + PARAMS_SIZE + PROC_INFO_SIZE + TMP_BUFFER_SIZE + STACK_SIZE |
137 | program.params dd END + PATH_SIZE |
137 | program.params dd END + PATH_SIZE |
138 | program.path dd END |
138 | program.path dd END |
139 | ; ---------------------------------------------------------------------------- ; |
139 | ; ---------------------------------------------------------------------------- ; |
140 | slot dd -1 ; for default if no params |
140 | slot dd -1 ; for default if no params |
141 | ; ---------------------------------------------------------------------------- ; |
141 | ; ---------------------------------------------------------------------------- ; |
142 | screen: |
142 | screen: |
143 | .height dw 0 |
143 | .height dw 0 |
144 | .width dw 0 |
144 | .width dw 0 |
145 | ; ---------------------------------------------------------------------------- ; |
145 | ; ---------------------------------------------------------------------------- ; |
146 | window: |
146 | window: |
147 | .left dd 0 |
147 | .left dd 0 |
148 | .top dd 0 |
148 | .top dd 0 |
149 | .width dd 0 |
149 | .width dd 0 |
150 | .height dd 0 |
150 | .height dd 0 |
151 | ; ---------------------------------------------------------------------------- ; |
151 | ; ---------------------------------------------------------------------------- ; |
152 | fore_color dd 0x00000000 |
152 | fore_color dd 0x00000000 |
153 | back_color dd ITEM_BACK_COLOR_1 |
153 | back_color dd ITEM_BACK_COLOR_1 |
154 | frame_color dd 0x00CCCCCC |
154 | frame_color dd 0x00CCCCCC |
155 | ; ---------------------------------------------------------------------------- ; |
155 | ; ---------------------------------------------------------------------------- ; |
156 | BackColors: |
156 | BackColors: |
157 | dd 1 |
157 | dd 1 |
158 | dd ITEM_BACK_COLOR_1 |
158 | dd ITEM_BACK_COLOR_1 |
159 | dd ITEM_BACK_COLOR_2 |
159 | dd ITEM_BACK_COLOR_2 |
160 | ; ---------------------------------------------------------------------------- ; |
160 | ; ---------------------------------------------------------------------------- ; |
161 | IndicatorColors: |
161 | IndicatorColors: |
162 | dd 1 |
162 | dd 1 |
163 | dd 0x000AF000 |
163 | dd 0x000AF000 |
164 | dd 0x00000FA0 |
164 | dd 0x00000FA0 |
165 | ; ---------------------------------------------------------------------------- ; |
165 | ; ---------------------------------------------------------------------------- ; |
166 | %define x [Pos.x] |
166 | %define x [Pos.x] |
167 | %define y [Pos.y] |
167 | %define y [Pos.y] |
168 | Pos: |
168 | Pos: |
169 | .x dd COLUMN1_X |
169 | .x dd COLUMN1_X |
170 | .y dd COLUMN_Y |
170 | .y dd COLUMN_Y |
171 | ; ---------------------------------------------------------------------------- ; |
171 | ; ---------------------------------------------------------------------------- ; |
172 | sz_caption db "ThreadInfo",0 |
172 | sz_caption db "ThreadInfo",0 |
173 | ; ---------------------------------------------------------------------------- ; |
173 | ; ---------------------------------------------------------------------------- ; |
174 | sz_cpu_usage db "CPU usage",0 |
174 | sz_cpu_usage db "CPU usage",0 |
175 | sz_win_stack_pos db "Win stack pos",0 |
175 | sz_win_stack_pos db "Win stack pos",0 |
176 | sz_name db "Name",0 |
176 | sz_name db "Name",0 |
177 | sz_mem_address db "Mem address",0 |
177 | sz_mem_address db "Mem address",0 |
178 | sz_mem_usage db "Mem usage",0 |
178 | sz_mem_usage db "Mem usage",0 |
179 | sz_identifier db "Identifier",0 |
179 | sz_identifier db "Identifier",0 |
180 | sz_x db "X",0 |
180 | sz_x db "X",0 |
181 | sz_y db "Y",0 |
181 | sz_y db "Y",0 |
182 | sz_size_x db "Size X",0 |
182 | sz_size_x db "Size X",0 |
183 | sz_size_y db "Size Y",0 |
183 | sz_size_y db "Size Y",0 |
184 | sz_thread_state db "Thread state",0 |
184 | sz_thread_state db "Thread state",0 |
185 | sz_client_x db "Client X",0 |
185 | sz_client_x db "Client X",0 |
186 | sz_client_y db "Client Y",0 |
186 | sz_client_y db "Client Y",0 |
187 | sz_client_size_x db "Client Size X",0 |
187 | sz_client_size_x db "Client Size X",0 |
188 | sz_client_size_y db "Client Size Y",0 |
188 | sz_client_size_y db "Client Size Y",0 |
189 | sz_window_state db "Window state",0 |
189 | sz_window_state db "Window state",0 |
190 | sz_event_mask db "Event mask",0 |
190 | sz_event_mask db "Event mask",0 |
191 | sz_keyboard_mode db "Keyboard mode",0 |
191 | sz_keyboard_mode db "Keyboard mode",0 |
192 | ; ---------------------------------------------------------------------------- ; |
192 | ; ---------------------------------------------------------------------------- ; |
193 | ; state of the window |
193 | ; state of the window |
194 | sz_maximized db "Max ",0 |
194 | sz_maximized db "Max ",0 |
195 | sz_minimized db "Min ",0 |
195 | sz_minimized db "Min ",0 |
196 | sz_rolled_up db "RollUp ",0 |
196 | sz_rolled_up db "RollUp ",0 |
197 | ; ---------------------------------------------------------------------------- ; |
197 | ; ---------------------------------------------------------------------------- ; |
198 | ; keyboard mode |
198 | ; keyboard mode |
199 | sz_ascii db "ASCII",0 |
199 | sz_ascii db "ASCII",0 |
200 | sz_scan db "SCAN ",0 |
200 | sz_scan db "SCAN ",0 |
201 | ; ---------------------------------------------------------------------------- ; |
201 | ; ---------------------------------------------------------------------------- ; |
202 | ; status of the thread slot |
202 | ; status of the thread slot |
203 | sz_running db "running ",0 |
203 | sz_running db "running ",0 |
204 | sz_suspended db "suspended ",0 |
204 | sz_suspended db "suspended ",0 |
205 | sz_suspended_wait_event db "suspended wait event",0 |
205 | sz_suspended_wait_event db "suspended wait event",0 |
206 | sz_normal_terminating db "normal terminating ",0 |
206 | sz_normal_terminating db "normal terminating ",0 |
207 | sz_except_terminating db "except. terminating ",0 |
207 | sz_except_terminating db "except. terminating ",0 |
208 | sz_wait_event db "wait event ",0 |
208 | sz_wait_event db "wait event ",0 |
209 | sz_slot_is_free db "slot is free ",0 |
209 | sz_slot_is_free db "slot is free ",0 |
210 | ; ---------------------------------------------------------------------------- ; |
210 | ; ---------------------------------------------------------------------------- ; |
211 | ; event mask |
211 | ; event mask |
212 | sz_redraw db "rdrw ",0 |
212 | sz_redraw db "rdrw ",0 |
213 | sz_key db "key ",0 |
213 | sz_key db "key ",0 |
214 | sz_button db "btn ",0 |
214 | sz_button db "btn ",0 |
215 | sz_reserved0 db "rsrvd0 ",0 |
215 | sz_reserved0 db "rsrvd0 ",0 |
216 | sz_redraw_background db "bckgr ",0 |
216 | sz_redraw_background db "bckgr ",0 |
217 | sz_mouse db "mouse ",0 |
217 | sz_mouse db "mouse ",0 |
218 | sz_ipc db "ipc ",0 |
218 | sz_ipc db "ipc ",0 |
219 | sz_network db "net ",0 |
219 | sz_network db "net ",0 |
220 | sz_debug db "dbg ",0 |
220 | sz_debug db "dbg ",0 |
221 | ; ---------------------------------------------------------------------------- ; |
221 | ; ---------------------------------------------------------------------------- ; |
222 | sz_undefined db "UnDef ",0 |
222 | sz_undefined db "UnDef ",0 |
223 | ; **************************************************************************** ; |
223 | ; **************************************************************************** ; |
224 | %macro DrawCpuUsage 0 |
224 | %macro DrawCpuUsage 0 |
225 | ; sz_cpu_usage |
225 | ; sz_cpu_usage |
226 | push dword COLUMN1_TEXT_X |
226 | push dword COLUMN1_TEXT_X |
227 | push dword y |
227 | push dword y |
228 | push dword sz_cpu_usage |
228 | push dword sz_cpu_usage |
229 | push dword [fore_color] |
229 | push dword [fore_color] |
230 | push dword [back_color] |
230 | push dword [back_color] |
231 | call DrawText |
231 | call DrawText |
232 | ; [cpu_usage] |
232 | ; [cpu_usage] |
233 | push dword [thread_info + THREAD_INFO.cpu_usage] |
233 | push dword [thread_info + THREAD_INFO.cpu_usage] |
234 | call uint2str |
234 | call uint2str |
235 | push dword COLUMN2_MAX_COUNT |
235 | push dword COLUMN2_MAX_COUNT |
236 | call PadBuffSpaces |
236 | call PadBuffSpaces |
237 | push dword COLUMN2_TEXT_X |
237 | push dword COLUMN2_TEXT_X |
238 | push dword y |
238 | push dword y |
239 | push dword tmpbuffer |
239 | push dword tmpbuffer |
240 | push dword [fore_color] |
240 | push dword [fore_color] |
241 | push dword [back_color] |
241 | push dword [back_color] |
242 | call DrawText |
242 | call DrawText |
243 | call ChangeBackColor |
243 | call ChangeBackColor |
244 | add y, dword ITEM_HEIGHT |
244 | add y, dword ITEM_HEIGHT |
245 | %endmacro |
245 | %endmacro |
246 | ; **************************************************************************** ; |
246 | ; **************************************************************************** ; |
247 | %macro DrawWinStackPos 0 |
247 | %macro DrawWinStackPos 0 |
248 | ; sz_win_stack_pos |
248 | ; sz_win_stack_pos |
249 | push dword COLUMN1_TEXT_X |
249 | push dword COLUMN1_TEXT_X |
250 | push dword y |
250 | push dword y |
251 | push dword sz_win_stack_pos |
251 | push dword sz_win_stack_pos |
252 | push dword [fore_color] |
252 | push dword [fore_color] |
253 | push dword [back_color] |
253 | push dword [back_color] |
254 | call DrawText |
254 | call DrawText |
255 | ; [win_stack_pos] |
255 | ; [win_stack_pos] |
256 | movzx eax, word [thread_info + THREAD_INFO.win_stack_pos] |
256 | movzx eax, word [thread_info + THREAD_INFO.win_stack_pos] |
257 | push eax |
257 | push eax |
258 | call uint2str |
258 | call uint2str |
259 | push dword COLUMN2_MAX_COUNT |
259 | push dword COLUMN2_MAX_COUNT |
260 | call PadBuffSpaces |
260 | call PadBuffSpaces |
261 | push dword COLUMN2_TEXT_X |
261 | push dword COLUMN2_TEXT_X |
262 | push dword y |
262 | push dword y |
263 | push dword tmpbuffer |
263 | push dword tmpbuffer |
264 | push dword [fore_color] |
264 | push dword [fore_color] |
265 | push dword [back_color] |
265 | push dword [back_color] |
266 | call DrawText |
266 | call DrawText |
267 | call ChangeBackColor |
267 | call ChangeBackColor |
268 | add y, dword ITEM_HEIGHT |
268 | add y, dword ITEM_HEIGHT |
269 | %endmacro |
269 | %endmacro |
270 | ; **************************************************************************** ; |
270 | ; **************************************************************************** ; |
271 | %macro DrawName 0 |
271 | %macro DrawName 0 |
272 | ; sz_name |
272 | ; sz_name |
273 | push dword COLUMN1_TEXT_X |
273 | push dword COLUMN1_TEXT_X |
274 | push dword y |
274 | push dword y |
275 | push dword sz_name |
275 | push dword sz_name |
276 | push dword [fore_color] |
276 | push dword [fore_color] |
277 | push dword [back_color] |
277 | push dword [back_color] |
278 | call DrawText |
278 | call DrawText |
279 | ; name |
279 | ; name |
280 | push dword COLUMN2_TEXT_X |
280 | push dword COLUMN2_TEXT_X |
281 | push dword y |
281 | push dword y |
282 | push dword (thread_info + THREAD_INFO.name) |
282 | push dword (thread_info + THREAD_INFO.name) |
283 | push dword [fore_color] |
283 | push dword [fore_color] |
284 | push dword [back_color] |
284 | push dword [back_color] |
285 | call DrawText |
285 | call DrawText |
286 | call ChangeBackColor |
286 | call ChangeBackColor |
287 | add y, dword ITEM_HEIGHT |
287 | add y, dword ITEM_HEIGHT |
288 | %endmacro |
288 | %endmacro |
289 | ; **************************************************************************** ; |
289 | ; **************************************************************************** ; |
290 | %macro DrawMemAddress 0 |
290 | %macro DrawMemAddress 0 |
291 | ; sz_mem_address |
291 | ; sz_mem_address |
292 | push dword COLUMN1_TEXT_X |
292 | push dword COLUMN1_TEXT_X |
293 | push dword y |
293 | push dword y |
294 | push dword sz_mem_address |
294 | push dword sz_mem_address |
295 | push dword [fore_color] |
295 | push dword [fore_color] |
296 | push dword [back_color] |
296 | push dword [back_color] |
297 | call DrawText |
297 | call DrawText |
298 | ; [mem_address] |
298 | ; [mem_address] |
299 | push dword [thread_info + THREAD_INFO.mem_address] |
299 | push dword [thread_info + THREAD_INFO.mem_address] |
300 | call uint2str |
300 | call uint2str |
301 | push dword COLUMN2_MAX_COUNT |
301 | push dword COLUMN2_MAX_COUNT |
302 | call PadBuffSpaces |
302 | call PadBuffSpaces |
303 | push dword COLUMN2_TEXT_X |
303 | push dword COLUMN2_TEXT_X |
304 | push dword y |
304 | push dword y |
305 | push dword tmpbuffer |
305 | push dword tmpbuffer |
306 | push dword [fore_color] |
306 | push dword [fore_color] |
307 | push dword [back_color] |
307 | push dword [back_color] |
308 | call DrawText |
308 | call DrawText |
309 | call ChangeBackColor |
309 | call ChangeBackColor |
310 | add y, dword ITEM_HEIGHT |
310 | add y, dword ITEM_HEIGHT |
311 | %endmacro |
311 | %endmacro |
312 | ; **************************************************************************** ; |
312 | ; **************************************************************************** ; |
313 | %macro DrawMemUsage 0 |
313 | %macro DrawMemUsage 0 |
314 | ; sz_mem_usage |
314 | ; sz_mem_usage |
315 | push dword COLUMN1_TEXT_X |
315 | push dword COLUMN1_TEXT_X |
316 | push dword y |
316 | push dword y |
317 | push dword sz_mem_usage |
317 | push dword sz_mem_usage |
318 | push dword [fore_color] |
318 | push dword [fore_color] |
319 | push dword [back_color] |
319 | push dword [back_color] |
320 | call DrawText |
320 | call DrawText |
321 | ; [mem_usage] |
321 | ; [mem_usage] |
322 | push dword [thread_info + THREAD_INFO.mem_usage] |
322 | push dword [thread_info + THREAD_INFO.mem_usage] |
323 | call uint2str |
323 | call uint2str |
324 | push dword COLUMN2_MAX_COUNT |
324 | push dword COLUMN2_MAX_COUNT |
325 | call PadBuffSpaces |
325 | call PadBuffSpaces |
326 | push dword COLUMN2_TEXT_X |
326 | push dword COLUMN2_TEXT_X |
327 | push dword y |
327 | push dword y |
328 | push dword tmpbuffer |
328 | push dword tmpbuffer |
329 | push dword [fore_color] |
329 | push dword [fore_color] |
330 | push dword [back_color] |
330 | push dword [back_color] |
331 | call DrawText |
331 | call DrawText |
332 | call ChangeBackColor |
332 | call ChangeBackColor |
333 | add y, dword ITEM_HEIGHT |
333 | add y, dword ITEM_HEIGHT |
334 | %endmacro |
334 | %endmacro |
335 | ; **************************************************************************** ; |
335 | ; **************************************************************************** ; |
336 | %macro DrawIdentifier 0 |
336 | %macro DrawIdentifier 0 |
337 | ; sz_identifier |
337 | ; sz_identifier |
338 | push dword COLUMN1_TEXT_X |
338 | push dword COLUMN1_TEXT_X |
339 | push dword y |
339 | push dword y |
340 | push dword sz_identifier |
340 | push dword sz_identifier |
341 | push dword [fore_color] |
341 | push dword [fore_color] |
342 | push dword [back_color] |
342 | push dword [back_color] |
343 | call DrawText |
343 | call DrawText |
344 | ; [identifier] |
344 | ; [identifier] |
345 | push dword [thread_info + THREAD_INFO.identifier] |
345 | push dword [thread_info + THREAD_INFO.identifier] |
346 | call uint2str |
346 | call uint2str |
347 | push dword COLUMN2_MAX_COUNT |
347 | push dword COLUMN2_MAX_COUNT |
348 | call PadBuffSpaces |
348 | call PadBuffSpaces |
349 | push dword COLUMN2_TEXT_X |
349 | push dword COLUMN2_TEXT_X |
350 | push dword y |
350 | push dword y |
351 | push dword tmpbuffer |
351 | push dword tmpbuffer |
352 | push dword [fore_color] |
352 | push dword [fore_color] |
353 | push dword [back_color] |
353 | push dword [back_color] |
354 | call DrawText |
354 | call DrawText |
355 | call ChangeBackColor |
355 | call ChangeBackColor |
356 | add y, dword ITEM_HEIGHT |
356 | add y, dword ITEM_HEIGHT |
357 | %endmacro |
357 | %endmacro |
358 | ; **************************************************************************** ; |
358 | ; **************************************************************************** ; |
359 | %macro DrawWindowX 0 |
359 | %macro DrawWindowX 0 |
360 | ; sz_x |
360 | ; sz_x |
361 | push dword COLUMN1_TEXT_X |
361 | push dword COLUMN1_TEXT_X |
362 | push dword y |
362 | push dword y |
363 | push dword sz_x |
363 | push dword sz_x |
364 | push dword [fore_color] |
364 | push dword [fore_color] |
365 | push dword [back_color] |
365 | push dword [back_color] |
366 | call DrawText |
366 | call DrawText |
367 | ; [x] |
367 | ; [x] |
368 | push dword [thread_info + THREAD_INFO.x] |
368 | push dword [thread_info + THREAD_INFO.x] |
369 | call uint2str |
369 | call uint2str |
370 | push dword COLUMN2_MAX_COUNT |
370 | push dword COLUMN2_MAX_COUNT |
371 | call PadBuffSpaces |
371 | call PadBuffSpaces |
372 | push dword COLUMN2_TEXT_X |
372 | push dword COLUMN2_TEXT_X |
373 | push dword y |
373 | push dword y |
374 | push dword tmpbuffer |
374 | push dword tmpbuffer |
375 | push dword [fore_color] |
375 | push dword [fore_color] |
376 | push dword [back_color] |
376 | push dword [back_color] |
377 | call DrawText |
377 | call DrawText |
378 | call ChangeBackColor |
378 | call ChangeBackColor |
379 | add y, dword ITEM_HEIGHT |
379 | add y, dword ITEM_HEIGHT |
380 | %endmacro |
380 | %endmacro |
381 | ; **************************************************************************** ; |
381 | ; **************************************************************************** ; |
382 | %macro DrawWindowY 0 |
382 | %macro DrawWindowY 0 |
383 | ; sz_y |
383 | ; sz_y |
384 | push dword COLUMN1_TEXT_X |
384 | push dword COLUMN1_TEXT_X |
385 | push dword y |
385 | push dword y |
386 | push dword sz_y |
386 | push dword sz_y |
387 | push dword [fore_color] |
387 | push dword [fore_color] |
388 | push dword [back_color] |
388 | push dword [back_color] |
389 | call DrawText |
389 | call DrawText |
390 | ; [y] |
390 | ; [y] |
391 | push dword [thread_info + THREAD_INFO.y] |
391 | push dword [thread_info + THREAD_INFO.y] |
392 | call uint2str |
392 | call uint2str |
393 | push dword COLUMN2_MAX_COUNT |
393 | push dword COLUMN2_MAX_COUNT |
394 | call PadBuffSpaces |
394 | call PadBuffSpaces |
395 | push dword COLUMN2_TEXT_X |
395 | push dword COLUMN2_TEXT_X |
396 | push dword y |
396 | push dword y |
397 | push dword tmpbuffer |
397 | push dword tmpbuffer |
398 | push dword [fore_color] |
398 | push dword [fore_color] |
399 | push dword [back_color] |
399 | push dword [back_color] |
400 | call DrawText |
400 | call DrawText |
401 | call ChangeBackColor |
401 | call ChangeBackColor |
402 | add y, dword ITEM_HEIGHT |
402 | add y, dword ITEM_HEIGHT |
403 | %endmacro |
403 | %endmacro |
404 | ; **************************************************************************** ; |
404 | ; **************************************************************************** ; |
405 | %macro DrawWindowSizeX 0 |
405 | %macro DrawWindowSizeX 0 |
406 | ; sz_size_x |
406 | ; sz_size_x |
407 | push dword COLUMN1_TEXT_X |
407 | push dword COLUMN1_TEXT_X |
408 | push dword y |
408 | push dword y |
409 | push dword sz_size_x |
409 | push dword sz_size_x |
410 | push dword [fore_color] |
410 | push dword [fore_color] |
411 | push dword [back_color] |
411 | push dword [back_color] |
412 | call DrawText |
412 | call DrawText |
413 | ; [size_x] |
413 | ; [size_x] |
414 | push dword [thread_info + THREAD_INFO.size_x] |
414 | push dword [thread_info + THREAD_INFO.size_x] |
415 | call uint2str |
415 | call uint2str |
416 | push dword COLUMN2_MAX_COUNT |
416 | push dword COLUMN2_MAX_COUNT |
417 | call PadBuffSpaces |
417 | call PadBuffSpaces |
418 | push dword COLUMN2_TEXT_X |
418 | push dword COLUMN2_TEXT_X |
419 | push dword y |
419 | push dword y |
420 | push dword tmpbuffer |
420 | push dword tmpbuffer |
421 | push dword [fore_color] |
421 | push dword [fore_color] |
422 | push dword [back_color] |
422 | push dword [back_color] |
423 | call DrawText |
423 | call DrawText |
424 | call ChangeBackColor |
424 | call ChangeBackColor |
425 | add y, dword ITEM_HEIGHT |
425 | add y, dword ITEM_HEIGHT |
426 | %endmacro |
426 | %endmacro |
427 | ; **************************************************************************** ; |
427 | ; **************************************************************************** ; |
428 | %macro DrawWindowSizeY 0 |
428 | %macro DrawWindowSizeY 0 |
429 | ; sz_size_y |
429 | ; sz_size_y |
430 | push dword COLUMN1_TEXT_X |
430 | push dword COLUMN1_TEXT_X |
431 | push dword y |
431 | push dword y |
432 | push dword sz_size_y |
432 | push dword sz_size_y |
433 | push dword [fore_color] |
433 | push dword [fore_color] |
434 | push dword [back_color] |
434 | push dword [back_color] |
435 | call DrawText |
435 | call DrawText |
436 | ; [size_y] |
436 | ; [size_y] |
437 | push dword [thread_info + THREAD_INFO.size_y] |
437 | push dword [thread_info + THREAD_INFO.size_y] |
438 | call uint2str |
438 | call uint2str |
439 | push dword COLUMN2_MAX_COUNT |
439 | push dword COLUMN2_MAX_COUNT |
440 | call PadBuffSpaces |
440 | call PadBuffSpaces |
441 | push dword COLUMN2_TEXT_X |
441 | push dword COLUMN2_TEXT_X |
442 | push dword y |
442 | push dword y |
443 | push dword tmpbuffer |
443 | push dword tmpbuffer |
444 | push dword [fore_color] |
444 | push dword [fore_color] |
445 | push dword [back_color] |
445 | push dword [back_color] |
446 | call DrawText |
446 | call DrawText |
447 | call ChangeBackColor |
447 | call ChangeBackColor |
448 | add y, dword ITEM_HEIGHT |
448 | add y, dword ITEM_HEIGHT |
449 | %endmacro |
449 | %endmacro |
450 | ; **************************************************************************** ; |
450 | ; **************************************************************************** ; |
451 | %macro DrawThreadState 0 |
451 | %macro DrawThreadState 0 |
452 | ; sz_thread_state |
452 | ; sz_thread_state |
453 | push dword COLUMN1_TEXT_X |
453 | push dword COLUMN1_TEXT_X |
454 | push dword y |
454 | push dword y |
455 | push dword sz_thread_state |
455 | push dword sz_thread_state |
456 | push dword [fore_color] |
456 | push dword [fore_color] |
457 | push dword [back_color] |
457 | push dword [back_color] |
458 | call DrawText |
458 | call DrawText |
459 | ; decoded_thread_state & [thread_state] |
459 | ; decoded_thread_state & [thread_state] |
460 | movzx eax, word [thread_info + THREAD_INFO.thread_state] |
460 | movzx eax, word [thread_info + THREAD_INFO.thread_state] |
461 | push eax ; for "call uint2str" below |
461 | push eax ; for "call uint2str" below |
462 | %%running: |
462 | %%running: |
463 | cmp eax, THREAD_STATE_RUNNING |
463 | cmp eax, THREAD_STATE_RUNNING |
464 | jne %%suspended |
464 | jne %%suspended |
465 | mov eax, sz_running |
465 | mov eax, sz_running |
466 | jmp %%draw_decoded_thread_state |
466 | jmp %%draw_decoded_thread_state |
467 | %%suspended: |
467 | %%suspended: |
468 | cmp eax, THREAD_STATE_SUSPENDED |
468 | cmp eax, THREAD_STATE_SUSPENDED |
469 | jne %%suspended_w |
469 | jne %%suspended_w |
470 | mov eax, sz_suspended |
470 | mov eax, sz_suspended |
471 | jmp %%draw_decoded_thread_state |
471 | jmp %%draw_decoded_thread_state |
472 | %%suspended_w: |
472 | %%suspended_w: |
473 | cmp eax, THREAD_STATE_SUSPENDED_WAIT_EVENT |
473 | cmp eax, THREAD_STATE_SUSPENDED_WAIT_EVENT |
474 | jne %%normal_term |
474 | jne %%normal_term |
475 | mov eax, sz_suspended_wait_event |
475 | mov eax, sz_suspended_wait_event |
476 | jmp %%draw_decoded_thread_state |
476 | jmp %%draw_decoded_thread_state |
477 | %%normal_term: |
477 | %%normal_term: |
478 | cmp eax, THREAD_STATE_NORMAL_TERMINATING |
478 | cmp eax, THREAD_STATE_NORMAL_TERMINATING |
479 | jne %%except_term |
479 | jne %%except_term |
480 | mov eax, sz_normal_terminating |
480 | mov eax, sz_normal_terminating |
481 | jmp %%draw_decoded_thread_state |
481 | jmp %%draw_decoded_thread_state |
482 | %%except_term: |
482 | %%except_term: |
483 | cmp eax, THREAD_STATE_EXCEPT_TERMINATING |
483 | cmp eax, THREAD_STATE_EXCEPT_TERMINATING |
484 | jne %%wait_event |
484 | jne %%wait_event |
485 | mov eax, sz_except_terminating |
485 | mov eax, sz_except_terminating |
486 | jmp %%draw_decoded_thread_state |
486 | jmp %%draw_decoded_thread_state |
487 | %%wait_event: |
487 | %%wait_event: |
488 | cmp eax, THREAD_STATE_WAIT_EVENT |
488 | cmp eax, THREAD_STATE_WAIT_EVENT |
489 | jne %%slot_free |
489 | jne %%slot_free |
490 | mov eax, sz_wait_event |
490 | mov eax, sz_wait_event |
491 | jmp %%draw_decoded_thread_state |
491 | jmp %%draw_decoded_thread_state |
492 | %%slot_free: |
492 | %%slot_free: |
493 | cmp eax, THREAD_STATE_SLOT_IS_FREE |
493 | cmp eax, THREAD_STATE_SLOT_IS_FREE |
494 | jne %%undefined |
494 | jne %%undefined |
495 | mov eax, sz_slot_is_free |
495 | mov eax, sz_slot_is_free |
496 | jmp %%draw_decoded_thread_state |
496 | jmp %%draw_decoded_thread_state |
497 | %%undefined: |
497 | %%undefined: |
498 | mov eax, sz_undefined |
498 | mov eax, sz_undefined |
499 | %%draw_decoded_thread_state: |
499 | %%draw_decoded_thread_state: |
500 | push dword COLUMN3_TEXT_X |
500 | push dword COLUMN3_TEXT_X |
501 | push dword y |
501 | push dword y |
502 | push eax |
502 | push eax |
503 | push dword [fore_color] |
503 | push dword [fore_color] |
504 | push dword [back_color] |
504 | push dword [back_color] |
505 | call DrawText |
505 | call DrawText |
506 | call uint2str |
506 | call uint2str |
507 | push dword COLUMN2_MAX_COUNT |
507 | push dword COLUMN2_MAX_COUNT |
508 | call PadBuffSpaces |
508 | call PadBuffSpaces |
509 | push dword COLUMN2_TEXT_X |
509 | push dword COLUMN2_TEXT_X |
510 | push dword y |
510 | push dword y |
511 | push dword tmpbuffer |
511 | push dword tmpbuffer |
512 | push dword [fore_color] |
512 | push dword [fore_color] |
513 | push dword [back_color] |
513 | push dword [back_color] |
514 | call DrawText |
514 | call DrawText |
515 | call ChangeBackColor |
515 | call ChangeBackColor |
516 | add y, dword ITEM_HEIGHT |
516 | add y, dword ITEM_HEIGHT |
517 | %endmacro |
517 | %endmacro |
518 | ; **************************************************************************** ; |
518 | ; **************************************************************************** ; |
519 | %macro DrawClientX 0 |
519 | %macro DrawClientX 0 |
520 | ; sz_client_x |
520 | ; sz_client_x |
521 | push dword COLUMN1_TEXT_X |
521 | push dword COLUMN1_TEXT_X |
522 | push dword y |
522 | push dword y |
523 | push dword sz_client_x |
523 | push dword sz_client_x |
524 | push dword [fore_color] |
524 | push dword [fore_color] |
525 | push dword [back_color] |
525 | push dword [back_color] |
526 | call DrawText |
526 | call DrawText |
527 | ; [client_x] |
527 | ; [client_x] |
528 | push dword [thread_info + THREAD_INFO.client_x] |
528 | push dword [thread_info + THREAD_INFO.client_x] |
529 | call uint2str |
529 | call uint2str |
530 | push dword COLUMN2_MAX_COUNT |
530 | push dword COLUMN2_MAX_COUNT |
531 | call PadBuffSpaces |
531 | call PadBuffSpaces |
532 | push dword COLUMN2_TEXT_X |
532 | push dword COLUMN2_TEXT_X |
533 | push dword y |
533 | push dword y |
534 | push dword tmpbuffer |
534 | push dword tmpbuffer |
535 | push dword [fore_color] |
535 | push dword [fore_color] |
536 | push dword [back_color] |
536 | push dword [back_color] |
537 | call DrawText |
537 | call DrawText |
538 | call ChangeBackColor |
538 | call ChangeBackColor |
539 | add y, dword ITEM_HEIGHT |
539 | add y, dword ITEM_HEIGHT |
540 | %endmacro |
540 | %endmacro |
541 | ; **************************************************************************** ; |
541 | ; **************************************************************************** ; |
542 | %macro DrawClientY 0 |
542 | %macro DrawClientY 0 |
543 | ; sz_client_y |
543 | ; sz_client_y |
544 | push dword COLUMN1_TEXT_X |
544 | push dword COLUMN1_TEXT_X |
545 | push dword y |
545 | push dword y |
546 | push dword sz_client_y |
546 | push dword sz_client_y |
547 | push dword [fore_color] |
547 | push dword [fore_color] |
548 | push dword [back_color] |
548 | push dword [back_color] |
549 | call DrawText |
549 | call DrawText |
550 | ; [client_y] |
550 | ; [client_y] |
551 | push dword [thread_info + THREAD_INFO.client_y] |
551 | push dword [thread_info + THREAD_INFO.client_y] |
552 | call uint2str |
552 | call uint2str |
553 | push dword COLUMN2_MAX_COUNT |
553 | push dword COLUMN2_MAX_COUNT |
554 | call PadBuffSpaces |
554 | call PadBuffSpaces |
555 | push dword COLUMN2_TEXT_X |
555 | push dword COLUMN2_TEXT_X |
556 | push dword y |
556 | push dword y |
557 | push dword tmpbuffer |
557 | push dword tmpbuffer |
558 | push dword [fore_color] |
558 | push dword [fore_color] |
559 | push dword [back_color] |
559 | push dword [back_color] |
560 | call DrawText |
560 | call DrawText |
561 | call ChangeBackColor |
561 | call ChangeBackColor |
562 | add y, dword ITEM_HEIGHT |
562 | add y, dword ITEM_HEIGHT |
563 | %endmacro |
563 | %endmacro |
564 | ; **************************************************************************** ; |
564 | ; **************************************************************************** ; |
565 | %macro DrawClientSizeX 0 |
565 | %macro DrawClientSizeX 0 |
566 | ; sz_client_size_x |
566 | ; sz_client_size_x |
567 | push dword COLUMN1_TEXT_X |
567 | push dword COLUMN1_TEXT_X |
568 | push dword y |
568 | push dword y |
569 | push dword sz_client_size_x |
569 | push dword sz_client_size_x |
570 | push dword [fore_color] |
570 | push dword [fore_color] |
571 | push dword [back_color] |
571 | push dword [back_color] |
572 | call DrawText |
572 | call DrawText |
573 | ; [client_size_x] |
573 | ; [client_size_x] |
574 | push dword [thread_info + THREAD_INFO.client_size_x] |
574 | push dword [thread_info + THREAD_INFO.client_size_x] |
575 | call uint2str |
575 | call uint2str |
576 | push dword COLUMN2_MAX_COUNT |
576 | push dword COLUMN2_MAX_COUNT |
577 | call PadBuffSpaces |
577 | call PadBuffSpaces |
578 | push dword COLUMN2_TEXT_X |
578 | push dword COLUMN2_TEXT_X |
579 | push dword y |
579 | push dword y |
580 | push dword tmpbuffer |
580 | push dword tmpbuffer |
581 | push dword [fore_color] |
581 | push dword [fore_color] |
582 | push dword [back_color] |
582 | push dword [back_color] |
583 | call DrawText |
583 | call DrawText |
584 | call ChangeBackColor |
584 | call ChangeBackColor |
585 | add y, dword ITEM_HEIGHT |
585 | add y, dword ITEM_HEIGHT |
586 | %endmacro |
586 | %endmacro |
587 | ; **************************************************************************** ; |
587 | ; **************************************************************************** ; |
588 | %macro DrawClientSizeY 0 |
588 | %macro DrawClientSizeY 0 |
589 | ; sz_client_size_y |
589 | ; sz_client_size_y |
590 | push dword COLUMN1_TEXT_X |
590 | push dword COLUMN1_TEXT_X |
591 | push dword y |
591 | push dword y |
592 | push dword sz_client_size_y |
592 | push dword sz_client_size_y |
593 | push dword [fore_color] |
593 | push dword [fore_color] |
594 | push dword [back_color] |
594 | push dword [back_color] |
595 | call DrawText |
595 | call DrawText |
596 | ; [client_size_y] |
596 | ; [client_size_y] |
597 | push dword [thread_info + THREAD_INFO.client_size_y] |
597 | push dword [thread_info + THREAD_INFO.client_size_y] |
598 | call uint2str |
598 | call uint2str |
599 | push dword COLUMN2_MAX_COUNT |
599 | push dword COLUMN2_MAX_COUNT |
600 | call PadBuffSpaces |
600 | call PadBuffSpaces |
601 | push dword COLUMN2_TEXT_X |
601 | push dword COLUMN2_TEXT_X |
602 | push dword y |
602 | push dword y |
603 | push dword tmpbuffer |
603 | push dword tmpbuffer |
604 | push dword [fore_color] |
604 | push dword [fore_color] |
605 | push dword [back_color] |
605 | push dword [back_color] |
606 | call DrawText |
606 | call DrawText |
607 | call ChangeBackColor |
607 | call ChangeBackColor |
608 | add y, dword ITEM_HEIGHT |
608 | add y, dword ITEM_HEIGHT |
609 | %endmacro |
609 | %endmacro |
610 | ; **************************************************************************** ; |
610 | ; **************************************************************************** ; |
611 | %macro DrawWindowState 0 |
611 | %macro DrawWindowState 0 |
612 | ; sz_window_state |
612 | ; sz_window_state |
613 | push dword COLUMN1_TEXT_X |
613 | push dword COLUMN1_TEXT_X |
614 | push dword y |
614 | push dword y |
615 | push dword sz_window_state |
615 | push dword sz_window_state |
616 | push dword [fore_color] |
616 | push dword [fore_color] |
617 | push dword [back_color] |
617 | push dword [back_color] |
618 | call DrawText |
618 | call DrawText |
619 | ; decoded_window_state & [window_state] |
619 | ; decoded_window_state & [window_state] |
620 | movzx eax, byte [thread_info + THREAD_INFO.window_state] |
620 | movzx eax, byte [thread_info + THREAD_INFO.window_state] |
621 | push eax ; for "call uint2str" below |
621 | push eax ; for "call uint2str" below |
622 | mov ebx, eax |
622 | mov ebx, eax |
623 | mov [tmpbuffer], byte 0 |
623 | mov [tmpbuffer], byte 0 |
624 | %%maximized: |
624 | %%maximized: |
625 | test ebx, WINDOW_STATE_MAXIMIZED |
625 | test ebx, WINDOW_STATE_MAXIMIZED |
626 | jz %%minimized |
626 | jz %%minimized |
627 | push tmpbuffer |
627 | push tmpbuffer |
628 | push sz_maximized |
628 | push sz_maximized |
629 | call StringConcatenate |
629 | call StringConcatenate |
630 | %%minimized: |
630 | %%minimized: |
631 | test ebx, WINDOW_STATE_MINIMIZED |
631 | test ebx, WINDOW_STATE_MINIMIZED |
632 | jz %%rolled_up |
632 | jz %%rolled_up |
633 | push tmpbuffer |
633 | push tmpbuffer |
634 | push sz_minimized |
634 | push sz_minimized |
635 | call StringConcatenate |
635 | call StringConcatenate |
636 | %%rolled_up: |
636 | %%rolled_up: |
637 | test ebx, WINDOW_STATE_ROLLED_UP |
637 | test ebx, WINDOW_STATE_ROLLED_UP |
638 | jz %%draw_decoded_window_state |
638 | jz %%draw_decoded_window_state |
639 | push tmpbuffer |
639 | push tmpbuffer |
640 | push sz_rolled_up |
640 | push sz_rolled_up |
641 | call StringConcatenate |
641 | call StringConcatenate |
642 | %%draw_decoded_window_state: |
642 | %%draw_decoded_window_state: |
643 | push dword COLUMN3_MAX_COUNT |
643 | push dword COLUMN3_MAX_COUNT |
644 | call PadBuffSpaces |
644 | call PadBuffSpaces |
645 | push dword COLUMN3_TEXT_X |
645 | push dword COLUMN3_TEXT_X |
646 | push dword y |
646 | push dword y |
647 | push dword tmpbuffer |
647 | push dword tmpbuffer |
648 | push dword [fore_color] |
648 | push dword [fore_color] |
649 | push dword [back_color] |
649 | push dword [back_color] |
650 | call DrawText |
650 | call DrawText |
651 | call uint2str |
651 | call uint2str |
652 | push dword COLUMN2_MAX_COUNT |
652 | push dword COLUMN2_MAX_COUNT |
653 | call PadBuffSpaces |
653 | call PadBuffSpaces |
654 | push dword COLUMN2_TEXT_X |
654 | push dword COLUMN2_TEXT_X |
655 | push dword y |
655 | push dword y |
656 | push dword tmpbuffer |
656 | push dword tmpbuffer |
657 | push dword [fore_color] |
657 | push dword [fore_color] |
658 | push dword [back_color] |
658 | push dword [back_color] |
659 | call DrawText |
659 | call DrawText |
660 | call ChangeBackColor |
660 | call ChangeBackColor |
661 | add y, dword ITEM_HEIGHT |
661 | add y, dword ITEM_HEIGHT |
662 | %endmacro |
662 | %endmacro |
663 | ; **************************************************************************** ; |
663 | ; **************************************************************************** ; |
664 | %macro DrawEventMask 0 |
664 | %macro DrawEventMask 0 |
665 | ; sz_event_mask |
665 | ; sz_event_mask |
666 | push dword COLUMN1_TEXT_X |
666 | push dword COLUMN1_TEXT_X |
667 | push dword y |
667 | push dword y |
668 | push dword sz_event_mask |
668 | push dword sz_event_mask |
669 | push dword [fore_color] |
669 | push dword [fore_color] |
670 | push dword [back_color] |
670 | push dword [back_color] |
671 | call DrawText |
671 | call DrawText |
672 | ; decoded_event_mask & [event_mask] |
672 | ; decoded_event_mask & [event_mask] |
673 | mov eax, [thread_info + THREAD_INFO.event_mask] |
673 | mov eax, [thread_info + THREAD_INFO.event_mask] |
674 | push eax ; for "call uint2str" below |
674 | push eax ; for "call uint2str" below |
675 | mov ebx, eax |
675 | mov ebx, eax |
676 | mov [tmpbuffer], byte 0 |
676 | mov [tmpbuffer], byte 0 |
677 | %%redraw: |
677 | %%redraw: |
678 | test ebx, EM_REDRAW |
678 | test ebx, EM_REDRAW |
679 | jz %%key |
679 | jz %%key |
680 | push tmpbuffer |
680 | push tmpbuffer |
681 | push sz_redraw |
681 | push sz_redraw |
682 | call StringConcatenate |
682 | call StringConcatenate |
683 | %%key: |
683 | %%key: |
684 | test ebx, EM_KEY |
684 | test ebx, EM_KEY |
685 | jz %%button |
685 | jz %%button |
686 | push tmpbuffer |
686 | push tmpbuffer |
687 | push sz_key |
687 | push sz_key |
688 | call StringConcatenate |
688 | call StringConcatenate |
689 | %%button: |
689 | %%button: |
690 | test ebx, EM_BUTTON |
690 | test ebx, EM_BUTTON |
691 | jz %%reserved0 |
691 | jz %%reserved0 |
692 | push tmpbuffer |
692 | push tmpbuffer |
693 | push sz_button |
693 | push sz_button |
694 | call StringConcatenate |
694 | call StringConcatenate |
695 | %%reserved0: |
695 | %%reserved0: |
696 | test ebx, EM_RESERVED0 |
696 | test ebx, EM_RESERVED0 |
697 | jz %%redraw_background |
697 | jz %%redraw_background |
698 | push tmpbuffer |
698 | push tmpbuffer |
699 | push sz_reserved0 |
699 | push sz_reserved0 |
700 | call StringConcatenate |
700 | call StringConcatenate |
701 | %%redraw_background: |
701 | %%redraw_background: |
702 | test ebx, EM_REDRAW_BACKGROUND |
702 | test ebx, EM_REDRAW_BACKGROUND |
703 | jz %%mouse |
703 | jz %%mouse |
704 | push tmpbuffer |
704 | push tmpbuffer |
705 | push sz_redraw_background |
705 | push sz_redraw_background |
706 | call StringConcatenate |
706 | call StringConcatenate |
707 | %%mouse: |
707 | %%mouse: |
708 | test ebx, EM_MOUSE |
708 | test ebx, EM_MOUSE |
709 | jz %%ipc |
709 | jz %%ipc |
710 | push tmpbuffer |
710 | push tmpbuffer |
711 | push sz_mouse |
711 | push sz_mouse |
712 | call StringConcatenate |
712 | call StringConcatenate |
713 | %%ipc: |
713 | %%ipc: |
714 | test ebx, EM_IPC |
714 | test ebx, EM_IPC |
715 | jz %%network |
715 | jz %%network |
716 | push tmpbuffer |
716 | push tmpbuffer |
717 | push sz_ipc |
717 | push sz_ipc |
718 | call StringConcatenate |
718 | call StringConcatenate |
719 | %%network: |
719 | %%network: |
720 | test ebx, EM_NETWORK |
720 | test ebx, EM_NETWORK |
721 | jz %%debug |
721 | jz %%debug |
722 | push tmpbuffer |
722 | push tmpbuffer |
723 | push sz_network |
723 | push sz_network |
724 | call StringConcatenate |
724 | call StringConcatenate |
725 | %%debug: |
725 | %%debug: |
726 | test ebx, EM_DEBUG |
726 | test ebx, EM_DEBUG |
727 | jz %%draw_decoded_event_mask |
727 | jz %%draw_decoded_event_mask |
728 | push tmpbuffer |
728 | push tmpbuffer |
729 | push sz_debug |
729 | push sz_debug |
730 | call StringConcatenate |
730 | call StringConcatenate |
731 | %%draw_decoded_event_mask: |
731 | %%draw_decoded_event_mask: |
732 | push dword COLUMN3_MAX_COUNT |
732 | push dword COLUMN3_MAX_COUNT |
733 | call PadBuffSpaces |
733 | call PadBuffSpaces |
734 | push dword COLUMN3_TEXT_X |
734 | push dword COLUMN3_TEXT_X |
735 | push dword y |
735 | push dword y |
736 | push dword tmpbuffer |
736 | push dword tmpbuffer |
737 | push dword [fore_color] |
737 | push dword [fore_color] |
738 | push dword [back_color] |
738 | push dword [back_color] |
739 | call DrawText |
739 | call DrawText |
740 | call uint2str |
740 | call uint2str |
741 | push dword COLUMN2_MAX_COUNT |
741 | push dword COLUMN2_MAX_COUNT |
742 | call PadBuffSpaces |
742 | call PadBuffSpaces |
743 | push dword COLUMN2_TEXT_X |
743 | push dword COLUMN2_TEXT_X |
744 | push dword y |
744 | push dword y |
745 | push dword tmpbuffer |
745 | push dword tmpbuffer |
746 | push dword [fore_color] |
746 | push dword [fore_color] |
747 | push dword [back_color] |
747 | push dword [back_color] |
748 | call DrawText |
748 | call DrawText |
749 | call ChangeBackColor |
749 | call ChangeBackColor |
750 | add y, dword ITEM_HEIGHT |
750 | add y, dword ITEM_HEIGHT |
751 | %endmacro |
751 | %endmacro |
752 | ; **************************************************************************** ; |
752 | ; **************************************************************************** ; |
753 | %macro DrawKeyboardMode 0 |
753 | %macro DrawKeyboardMode 0 |
754 | push dword COLUMN2_MAX_COUNT |
754 | push dword COLUMN2_MAX_COUNT |
755 | call PadBuffSpaces |
755 | call PadBuffSpaces |
756 | ; sz_keyboard_mode |
756 | ; sz_keyboard_mode |
757 | push dword COLUMN1_TEXT_X |
757 | push dword COLUMN1_TEXT_X |
758 | push dword y |
758 | push dword y |
759 | push dword sz_keyboard_mode |
759 | push dword sz_keyboard_mode |
760 | push dword [fore_color] |
760 | push dword [fore_color] |
761 | push dword [back_color] |
761 | push dword [back_color] |
762 | call DrawText |
762 | call DrawText |
763 | ; decoded_keyboard_mode & [keyboard_mode] |
763 | ; decoded_keyboard_mode & [keyboard_mode] |
764 | movzx eax, byte [thread_info + THREAD_INFO.keyboard_mode] |
764 | movzx eax, byte [thread_info + THREAD_INFO.keyboard_mode] |
765 | push eax ; for "call uint2str" below |
765 | push eax ; for "call uint2str" below |
766 | %%ascii: |
766 | %%ascii: |
767 | cmp eax, KEYBOARD_MODE_ASCII |
767 | cmp eax, KEYBOARD_MODE_ASCII |
768 | jne %%scan |
768 | jne %%scan |
769 | mov eax, sz_ascii |
769 | mov eax, sz_ascii |
770 | jmp %%draw_decoded_keyboard_mode |
770 | jmp %%draw_decoded_keyboard_mode |
771 | %%scan: |
771 | %%scan: |
772 | cmp eax, KEYBOARD_MODE_SCAN |
772 | cmp eax, KEYBOARD_MODE_SCAN |
773 | jne %%undefined |
773 | jne %%undefined |
774 | mov eax, sz_scan |
774 | mov eax, sz_scan |
775 | jmp %%draw_decoded_keyboard_mode |
775 | jmp %%draw_decoded_keyboard_mode |
776 | %%undefined: |
776 | %%undefined: |
777 | mov eax, sz_undefined |
777 | mov eax, sz_undefined |
778 | %%draw_decoded_keyboard_mode: |
778 | %%draw_decoded_keyboard_mode: |
779 | push dword COLUMN3_TEXT_X |
779 | push dword COLUMN3_TEXT_X |
780 | push dword y |
780 | push dword y |
781 | push eax |
781 | push eax |
782 | push dword [fore_color] |
782 | push dword [fore_color] |
783 | push dword [back_color] |
783 | push dword [back_color] |
784 | call DrawText |
784 | call DrawText |
785 | call uint2str |
785 | call uint2str |
786 | push dword COLUMN2_TEXT_X |
786 | push dword COLUMN2_TEXT_X |
787 | push dword y |
787 | push dword y |
788 | push dword tmpbuffer |
788 | push dword tmpbuffer |
789 | push dword [fore_color] |
789 | push dword [fore_color] |
790 | push dword [back_color] |
790 | push dword [back_color] |
791 | call DrawText |
791 | call DrawText |
792 | call ChangeBackColor |
792 | call ChangeBackColor |
793 | add y, dword ITEM_HEIGHT |
793 | add y, dword ITEM_HEIGHT |
794 | %endmacro |
794 | %endmacro |
795 | ; **************************************************************************** ; |
795 | ; **************************************************************************** ; |
796 | %macro DrawUpdateIndicator 0 |
796 | %macro DrawUpdateIndicator 0 |
797 | mov eax, [IndicatorColors] |
797 | mov eax, [IndicatorColors] |
798 | sub eax, 3 |
798 | sub eax, 3 |
799 | neg eax |
799 | neg eax |
800 | mov [IndicatorColors], eax |
800 | mov [IndicatorColors], eax |
801 | ; draw.rectangle |
801 | ; draw.rectangle |
802 | mov edx, [eax * 4 + IndicatorColors] |
802 | mov edx, [eax * 4 + IndicatorColors] |
803 | mov eax, 13 |
803 | mov eax, 13 |
804 | mov ebx, INDICATOR_LEFT << 16 | INDICATOR_WIDTH |
804 | mov ebx, INDICATOR_LEFT << 16 | INDICATOR_WIDTH |
805 | mov ecx, INDICATOR_TOP << 16 | INDICATOR_HEIGHT |
805 | mov ecx, INDICATOR_TOP << 16 | INDICATOR_HEIGHT |
806 | int 64 |
806 | int 64 |
807 | %endmacro |
807 | %endmacro |
808 | ; **************************************************************************** ; |
808 | ; **************************************************************************** ; |
809 | %macro DrawTable 0 |
809 | %macro DrawTable 0 |
810 | ; DrawFrames |
810 | ; DrawFrames |
811 | push dword FRAME1_LEFT |
811 | push dword FRAME1_LEFT |
812 | push dword FRAME_TOP |
812 | push dword FRAME_TOP |
813 | push dword FRAME1_RIGHT |
813 | push dword FRAME1_RIGHT |
814 | push dword FRAME_BOTTOM |
814 | push dword FRAME_BOTTOM |
815 | push dword [frame_color] |
815 | push dword [frame_color] |
816 | call DrawFrame |
816 | call DrawFrame |
817 | push dword FRAME2_LEFT |
817 | push dword FRAME2_LEFT |
818 | push dword FRAME_TOP |
818 | push dword FRAME_TOP |
819 | push dword FRAME2_RIGHT |
819 | push dword FRAME2_RIGHT |
820 | push dword FRAME_BOTTOM |
820 | push dword FRAME_BOTTOM |
821 | push dword [frame_color] |
821 | push dword [frame_color] |
822 | call DrawFrame |
822 | call DrawFrame |
823 | push dword FRAME3_LEFT |
823 | push dword FRAME3_LEFT |
824 | push dword FRAME_TOP |
824 | push dword FRAME_TOP |
825 | push dword FRAME3_RIGHT |
825 | push dword FRAME3_RIGHT |
826 | push dword FRAME_BOTTOM |
826 | push dword FRAME_BOTTOM |
827 | push dword [frame_color] |
827 | push dword [frame_color] |
828 | call DrawFrame |
828 | call DrawFrame |
829 | ; DrawItems |
829 | ; DrawItems |
830 | mov esi, COLUMN_Y |
830 | mov esi, COLUMN_Y |
831 | xor edi, edi |
831 | xor edi, edi |
832 | %%draw_item: |
832 | %%draw_item: |
833 | cmp edi, ITEM_COUNT |
833 | cmp edi, ITEM_COUNT |
834 | jnl %%done |
834 | jnl %%done |
835 | mov ecx, esi |
835 | mov ecx, esi |
836 | shl ecx, 16 |
836 | shl ecx, 16 |
837 | or ecx, ITEM_HEIGHT |
837 | or ecx, ITEM_HEIGHT |
838 | ; draw.rectangle |
838 | ; draw.rectangle |
839 | mov eax, 13 |
839 | mov eax, 13 |
840 | mov ebx, COLUMN1_X << 16 | COLUMN1_ITEM_WIDTH |
840 | mov ebx, COLUMN1_X << 16 | COLUMN1_ITEM_WIDTH |
841 | mov edx, [back_color] |
841 | mov edx, [back_color] |
842 | int 64 |
842 | int 64 |
843 | ; draw.rectangle |
843 | ; draw.rectangle |
844 | mov eax, 13 |
844 | mov eax, 13 |
845 | mov ebx, COLUMN2_X << 16 | COLUMN2_ITEM_WIDTH |
845 | mov ebx, COLUMN2_X << 16 | COLUMN2_ITEM_WIDTH |
846 | mov edx, [back_color] |
846 | mov edx, [back_color] |
847 | int 64 |
847 | int 64 |
848 | ; draw.rectangle |
848 | ; draw.rectangle |
849 | mov eax, 13 |
849 | mov eax, 13 |
850 | mov ebx, COLUMN3_X << 16 | COLUMN3_ITEM_WIDTH |
850 | mov ebx, COLUMN3_X << 16 | COLUMN3_ITEM_WIDTH |
851 | mov edx, [back_color] |
851 | mov edx, [back_color] |
852 | int 64 |
852 | int 64 |
853 | call ChangeBackColor |
853 | call ChangeBackColor |
854 | add esi, ITEM_HEIGHT |
854 | add esi, ITEM_HEIGHT |
855 | inc edi |
855 | inc edi |
856 | jmp %%draw_item |
856 | jmp %%draw_item |
857 | %%done: |
857 | %%done: |
858 | %endmacro |
858 | %endmacro |
859 | ; ---------------------------------------------------------------------------- ; |
859 | ; ---------------------------------------------------------------------------- ; |
860 | align 4 |
860 | align 4 |
861 | START: |
861 | START: |
862 | mov esi, [program.params] |
862 | mov esi, [program.params] |
863 | test [esi], byte 0xFF |
863 | test [esi], byte 0xFF |
864 | jz .no_params |
864 | jz .no_params |
865 | ; str2uint(program.params) |
865 | ; str2uint(program.params) |
866 | xor eax, eax |
866 | xor eax, eax |
867 | xor ecx, ecx |
867 | xor ecx, ecx |
868 | .convert: |
868 | .convert: |
869 | lodsb |
869 | lodsb |
870 | test al, al |
870 | test al, al |
871 | jz .converted |
871 | jz .converted |
872 | lea ecx, [ecx + ecx * 4] |
872 | lea ecx, [ecx + ecx * 4] |
873 | lea ecx, [eax + ecx * 2 - 48] |
873 | lea ecx, [eax + ecx * 2 - 48] |
874 | jmp .convert |
874 | jmp .convert |
875 | .converted: |
875 | .converted: |
876 | mov [slot], ecx |
876 | mov [slot], ecx |
877 | .no_params: |
877 | .no_params: |
878 | ; get.screen.size |
878 | ; get.screen.size |
879 | mov eax, 61 |
879 | mov eax, 61 |
880 | mov ebx, 1 |
880 | mov ebx, 1 |
881 | int 64 |
881 | int 64 |
882 | mov [screen], eax |
882 | mov [screen], eax |
883 | ; skin.height |
883 | ; skin.height |
884 | mov eax, 48 |
884 | mov eax, 48 |
885 | mov ebx, 4 |
885 | mov ebx, 4 |
886 | int 64 |
886 | int 64 |
887 | add eax, FRAME_BOTTOM + FRAME_TOP + WINDOW_BORDER_SIZE |
887 | add eax, FRAME_BOTTOM + FRAME_TOP + WINDOW_BORDER_SIZE |
888 | mov [window.width], dword WINDOW_WIDTH |
888 | mov [window.width], dword WINDOW_WIDTH |
889 | mov [window.height], eax |
889 | mov [window.height], eax |
890 | movzx eax, word [screen.width] |
890 | movzx eax, word [screen.width] |
891 | movzx edx, word [screen.height] |
891 | movzx edx, word [screen.height] |
892 | sub eax, [window.width] |
892 | sub eax, [window.width] |
893 | sub edx, [window.height] |
893 | sub edx, [window.height] |
894 | shr eax, 1 |
894 | shr eax, 1 |
895 | shr edx, 1 |
895 | shr edx, 1 |
896 | mov [window.left], eax |
896 | mov [window.left], eax |
897 | mov [window.top], edx |
897 | mov [window.top], edx |
898 | ; set.event |
898 | ; set.event |
899 | mov eax, 40 |
899 | mov eax, 40 |
900 | mov ebx, EM_REDRAW | EM_BUTTON |
900 | mov ebx, EM_REDRAW | EM_BUTTON |
901 | int 64 |
901 | int 64 |
902 | ; ---------------------------------------------------------------------------- ; |
902 | ; ---------------------------------------------------------------------------- ; |
903 | align 4 |
903 | align 4 |
904 | on_redraw: |
904 | on_redraw: |
905 | ; redraw.start |
905 | ; redraw.start |
906 | mov eax, 12 |
906 | mov eax, 12 |
907 | mov ebx, 1 |
907 | mov ebx, 1 |
908 | int 64 |
908 | int 64 |
909 | ; draw.window |
909 | ; draw.window |
910 | xor eax, eax |
910 | xor eax, eax |
911 | mov ebx, [window.left] |
911 | mov ebx, [window.left] |
912 | mov ecx, [window.top] |
912 | mov ecx, [window.top] |
913 | shl ebx, 16 |
913 | shl ebx, 16 |
914 | shl ecx, 16 |
914 | shl ecx, 16 |
915 | or ebx, [window.width] |
915 | or ebx, [window.width] |
916 | or ecx, [window.height] |
916 | or ecx, [window.height] |
917 | mov edx, WINDOW_STYLE | WINDOW_BACK_COLOR |
917 | mov edx, WINDOW_STYLE | WINDOW_BACK_COLOR |
918 | mov edi, sz_caption |
918 | mov edi, sz_caption |
919 | xor esi, esi |
919 | xor esi, esi |
920 | int 64 |
920 | int 64 |
921 | ; redraw.finish |
921 | ; redraw.finish |
922 | mov eax, 12 |
922 | mov eax, 12 |
923 | mov ebx, 2 |
923 | mov ebx, 2 |
924 | int 64 |
924 | int 64 |
925 | DrawTable |
925 | DrawTable |
926 | call UpdateThreadInfo |
926 | call UpdateThreadInfo |
927 | align 4 |
927 | align 4 |
928 | wait.event.by.time: |
928 | wait.event.by.time: |
929 | mov eax, 23 |
929 | mov eax, 23 |
930 | mov ebx, UPDATE_TIME |
930 | mov ebx, UPDATE_TIME |
931 | int 64 |
931 | int 64 |
932 | dec eax |
932 | dec eax |
933 | jz on_redraw ; IF eax = 1 THEN redraw |
933 | jz on_redraw ; IF eax = 1 THEN redraw |
934 | jns on_button ; ELSEIF eax = 2 THEN button |
934 | jns on_button ; ELSEIF eax = 2 THEN button |
935 | call UpdateThreadInfo ; ELSE no event -> update thread info |
935 | call UpdateThreadInfo ; ELSE no event -> update thread info |
936 | jmp wait.event.by.time |
936 | jmp wait.event.by.time |
937 | align 4 |
937 | align 4 |
938 | on_button: ; terminate because we have only one button(close button) |
938 | on_button: ; terminate because we have only one button(close button) |
939 | or eax, -1 |
939 | or eax, -1 |
940 | int 64 |
940 | int 64 |
941 | ; ---------------------------------------------------------------------------- ; |
941 | ; ---------------------------------------------------------------------------- ; |
942 | align 4 |
942 | align 4 |
943 | UpdateThreadInfo: |
943 | UpdateThreadInfo: |
944 | ; get.thread.info |
944 | ; get.thread.info |
945 | mov eax, 9 |
945 | mov eax, 9 |
946 | mov ebx, thread_info |
946 | mov ebx, thread_info |
947 | mov ecx, [slot] |
947 | mov ecx, [slot] |
948 | int 64 |
948 | int 64 |
949 | 949 | ||
950 | mov x, dword COLUMN1_X |
950 | mov x, dword COLUMN1_X |
951 | mov y, dword COLUMN_Y + (ITEM_HEIGHT - TEXT_HEIGHT) / 2 |
951 | mov y, dword COLUMN_Y + (ITEM_HEIGHT - TEXT_HEIGHT) / 2 |
952 | mov [back_color], dword ITEM_BACK_COLOR_1 |
952 | mov [back_color], dword ITEM_BACK_COLOR_1 |
953 | mov [BackColors], dword 1 |
953 | mov [BackColors], dword 1 |
954 | ; order of next "Draw..." can be changed |
954 | ; order of next "Draw..." can be changed |
955 | DrawName |
955 | DrawName |
956 | DrawThreadState |
956 | DrawThreadState |
957 | DrawWindowState |
957 | DrawWindowState |
958 | DrawEventMask |
958 | DrawEventMask |
959 | DrawKeyboardMode |
959 | DrawKeyboardMode |
960 | DrawCpuUsage |
960 | DrawCpuUsage |
961 | DrawMemUsage |
961 | DrawMemUsage |
962 | DrawMemAddress |
962 | DrawMemAddress |
963 | DrawIdentifier |
963 | DrawIdentifier |
964 | DrawWinStackPos |
964 | DrawWinStackPos |
965 | DrawWindowX |
965 | DrawWindowX |
966 | DrawWindowY |
966 | DrawWindowY |
967 | DrawWindowSizeX |
967 | DrawWindowSizeX |
968 | DrawWindowSizeY |
968 | DrawWindowSizeY |
969 | DrawClientX |
969 | DrawClientX |
970 | DrawClientY |
970 | DrawClientY |
971 | DrawClientSizeX |
971 | DrawClientSizeX |
972 | DrawClientSizeY |
972 | DrawClientSizeY |
973 | 973 | ||
974 | DrawUpdateIndicator ; blinking thing at upper right corner |
974 | DrawUpdateIndicator ; blinking thing at upper right corner |
975 | 975 | ||
976 | ret |
976 | ret |
977 | ; ---------------------------------------------------------------------------- ; |
977 | ; ---------------------------------------------------------------------------- ; |
978 | align 4 |
978 | align 4 |
979 | DrawFrame: |
979 | DrawFrame: |
980 | %define Color [esp + 4 +1*4] |
980 | %define Color [esp + 4 +1*4] |
981 | %define Bottom [esp + 8 +1*4] |
981 | %define Bottom [esp + 8 +1*4] |
982 | %define Top [esp + 16 +1*4] |
982 | %define Top [esp + 16 +1*4] |
983 | %define Right [esp + 12 +1*4] |
983 | %define Right [esp + 12 +1*4] |
984 | %define Left [esp + 20 +1*4] |
984 | %define Left [esp + 20 +1*4] |
985 | push ebp |
985 | push ebp |
986 | mov eax, 38 |
986 | mov eax, 38 |
987 | mov edx, Color |
987 | mov edx, Color |
988 | mov esi, Bottom |
988 | mov esi, Bottom |
989 | mov edi, Top |
989 | mov edi, Top |
990 | mov ebp, Right |
990 | mov ebp, Right |
991 | mov ebx, Left |
991 | mov ebx, Left |
992 | shl ebx, 16 |
992 | shl ebx, 16 |
993 | mov bx, bp |
993 | mov bx, bp |
994 | shrd ecx, edi, 16 |
994 | shrd ecx, edi, 16 |
995 | mov cx, di |
995 | mov cx, di |
996 | int 64 |
996 | int 64 |
997 | shrd ecx, esi, 16 |
997 | shrd ecx, esi, 16 |
998 | mov cx, si |
998 | mov cx, si |
999 | int 64 |
999 | int 64 |
1000 | shld esi, ebx, 16 |
1000 | shld esi, ebx, 16 |
1001 | mov bx, si |
1001 | mov bx, si |
1002 | shrd ecx, edi, 16 |
1002 | shrd ecx, edi, 16 |
1003 | int 64 |
1003 | int 64 |
1004 | shrd ebx, ebp, 16 |
1004 | shrd ebx, ebp, 16 |
1005 | mov bx, bp |
1005 | mov bx, bp |
1006 | int 64 |
1006 | int 64 |
1007 | pop ebp |
1007 | pop ebp |
1008 | ret 20 |
1008 | ret 20 |
1009 | %undef Color |
1009 | %undef Color |
1010 | %undef Bottom |
1010 | %undef Bottom |
1011 | %undef Top |
1011 | %undef Top |
1012 | %undef Right |
1012 | %undef Right |
1013 | %undef Left |
1013 | %undef Left |
1014 | ; ---------------------------------------------------------------------------- ; |
1014 | ; ---------------------------------------------------------------------------- ; |
1015 | align 4 |
1015 | align 4 |
1016 | StringConcatenate: |
1016 | StringConcatenate: |
1017 | %define stradd [esp + 4] |
1017 | %define stradd [esp + 4] |
1018 | %define str [esp + 8] |
1018 | %define str [esp + 8] |
1019 | mov esi, stradd |
1019 | mov esi, stradd |
1020 | or ecx, -1 |
1020 | or ecx, -1 |
1021 | mov edi, esi |
1021 | mov edi, esi |
1022 | xor eax, eax |
1022 | xor eax, eax |
1023 | repne scasb |
1023 | repne scasb |
1024 | mov edx, ecx |
1024 | mov edx, ecx |
1025 | mov edi, str |
1025 | mov edi, str |
1026 | repne scasb |
1026 | repne scasb |
1027 | dec edi |
1027 | dec edi |
1028 | not edx |
1028 | not edx |
1029 | mov eax, str |
1029 | mov eax, str |
1030 | mov ecx, edx |
1030 | mov ecx, edx |
1031 | shr ecx, 2 |
1031 | shr ecx, 2 |
1032 | and edx, 3 |
1032 | and edx, 3 |
1033 | rep movsd |
1033 | rep movsd |
1034 | mov ecx, edx |
1034 | mov ecx, edx |
1035 | rep movsb |
1035 | rep movsb |
1036 | ret 8 |
1036 | ret 8 |
1037 | %undef stradd |
1037 | %undef stradd |
1038 | %undef str |
1038 | %undef str |
1039 | ; ---------------------------------------------------------------------------- ; |
1039 | ; ---------------------------------------------------------------------------- ; |
1040 | align 4 |
1040 | align 4 |
1041 | DrawText: |
1041 | DrawText: |
1042 | %define x [esp + 20] |
1042 | %define x [esp + 20] |
1043 | %define y [esp + 16] |
1043 | %define y [esp + 16] |
1044 | %define text [esp + 12] |
1044 | %define text [esp + 12] |
1045 | %define fore_color [esp + 8] |
1045 | %define fore_color [esp + 8] |
1046 | %define back_color [esp + 4] |
1046 | %define back_color [esp + 4] |
1047 | mov eax, 4 |
1047 | mov eax, 4 |
1048 | mov ecx, fore_color |
1048 | mov ecx, fore_color |
1049 | mov edi, back_color |
1049 | mov edi, back_color |
1050 | mov edx, text |
1050 | mov edx, text |
1051 | mov ebx, x |
1051 | mov ebx, x |
1052 | shl ebx, 16 |
1052 | shl ebx, 16 |
1053 | or ebx, y |
1053 | or ebx, y |
1054 | or ecx, 0xD0000000 |
1054 | or ecx, 0xD0000000 |
1055 | int 64 |
1055 | int 64 |
1056 | ret 20 |
1056 | ret 20 |
1057 | %undef x |
1057 | %undef x |
1058 | %undef y |
1058 | %undef y |
1059 | %undef text |
1059 | %undef text |
1060 | %undef fore_color |
1060 | %undef fore_color |
1061 | %undef back_color |
1061 | %undef back_color |
1062 | ; ---------------------------------------------------------------------------- ; |
1062 | ; ---------------------------------------------------------------------------- ; |
1063 | %comment |
1063 | %IF 0 |
1064 | align 4 |
1064 | align 4 |
1065 | DrawTextBold: |
1065 | DrawTextBold: |
1066 | %define x [esp + 20] |
1066 | %define x [esp + 20] |
1067 | %define y [esp + 16] |
1067 | %define y [esp + 16] |
1068 | %define text [esp + 12] |
1068 | %define text [esp + 12] |
1069 | %define fore_color [esp + 8] |
1069 | %define fore_color [esp + 8] |
1070 | %define back_color [esp + 4] |
1070 | %define back_color [esp + 4] |
1071 | mov eax, 4 |
1071 | mov eax, 4 |
1072 | mov ecx, fore_color |
1072 | mov ecx, fore_color |
1073 | mov edi, back_color |
1073 | mov edi, back_color |
1074 | mov esi, 1 ; count |
1074 | mov esi, 1 ; count |
1075 | mov edx, text |
1075 | mov edx, text |
1076 | mov ebx, x |
1076 | mov ebx, x |
1077 | shl ebx, 16 |
1077 | shl ebx, 16 |
1078 | or ebx, y |
1078 | or ebx, y |
1079 | align 4 |
1079 | align 4 |
1080 | .next: |
1080 | .next: |
1081 | test [edx], byte 0xFF |
1081 | test [edx], byte 0xFF |
1082 | jz .done |
1082 | jz .done |
1083 | or ecx, 0x50000000 |
1083 | or ecx, 0x50000000 |
1084 | int 64 |
1084 | int 64 |
1085 | add ebx, (1 << 16) |
1085 | add ebx, (1 << 16) |
1086 | and ecx, 0x10FFFFFF |
1086 | and ecx, 0x10FFFFFF |
1087 | int 64 |
1087 | int 64 |
1088 | add ebx, (TEXT_WIDTH << 16) |
1088 | add ebx, (TEXT_WIDTH << 16) |
1089 | inc edx |
1089 | inc edx |
1090 | jmp .next |
1090 | jmp .next |
1091 | align 4 |
1091 | align 4 |
1092 | .done: |
1092 | .done: |
1093 | ret 20 |
1093 | ret 20 |
1094 | %undef x |
1094 | %undef x |
1095 | %undef y |
1095 | %undef y |
1096 | %undef text |
1096 | %undef text |
1097 | %undef fore_color |
1097 | %undef fore_color |
1098 | %undef back_color |
1098 | %undef back_color |
1099 | %endcomment |
1099 | %ENDIF |
1100 | ; ---------------------------------------------------------------------------- ; |
1100 | ; ---------------------------------------------------------------------------- ; |
1101 | align 4 |
1101 | align 4 |
1102 | ChangeBackColor: |
1102 | ChangeBackColor: |
1103 | mov eax, [BackColors] |
1103 | mov eax, [BackColors] |
1104 | sub eax, 3 |
1104 | sub eax, 3 |
1105 | neg eax |
1105 | neg eax |
1106 | mov [BackColors], eax |
1106 | mov [BackColors], eax |
1107 | mov eax, [eax * 4 + BackColors] |
1107 | mov eax, [eax * 4 + BackColors] |
1108 | mov [back_color], eax |
1108 | mov [back_color], eax |
1109 | ret |
1109 | ret |
1110 | ; ---------------------------------------------------------------------------- ; |
1110 | ; ---------------------------------------------------------------------------- ; |
1111 | align 4 |
1111 | align 4 |
1112 | uint2str: |
1112 | uint2str: |
1113 | %define value [esp + 4] |
1113 | %define value [esp + 4] |
1114 | push dword value ; value |
1114 | push dword value ; value |
1115 | push dword 10 ; base(decimal) |
1115 | push dword 10 ; base(decimal) |
1116 | push dword tmpbuffer ; buffer |
1116 | push dword tmpbuffer ; buffer |
1117 | call ConvertToBase |
1117 | call ConvertToBase |
1118 | ret 4 |
1118 | ret 4 |
1119 | %undef value |
1119 | %undef value |
1120 | ; ---------------------------------------------------------------------------- ; |
1120 | ; ---------------------------------------------------------------------------- ; |
1121 | align 4 |
1121 | align 4 |
1122 | ConvertToBase: |
1122 | ConvertToBase: |
1123 | %define value [esp + 12] ; value treated as unsigned |
1123 | %define value [esp + 12] ; value treated as unsigned |
1124 | %define base [esp + 8] ; 2 <= base <= 36 |
1124 | %define base [esp + 8] ; 2 <= base <= 36 |
1125 | %define buffer [esp + 4] ; SizeOf(buffer) => (32 + 1) |
1125 | %define buffer [esp + 4] ; SizeOf(buffer) => (32 + 1) |
1126 | mov eax, value |
1126 | mov eax, value |
1127 | mov ecx, base |
1127 | mov ecx, base |
1128 | mov esi, buffer |
1128 | mov esi, buffer |
1129 | mov edi, esi ; +0 +31 +32 |
1129 | mov edi, esi ; +0 +31 +32 |
1130 | add esi, 32 ; base2(0xFFFFFFFF) = 11111111111111111111111111111111b |
1130 | add esi, 32 ; base2(0xFFFFFFFF) = 11111111111111111111111111111111b |
1131 | mov [esi], byte 0 ; end of string byte 0 |
1131 | mov [esi], byte 0 ; end of string byte 0 |
1132 | align 4 |
1132 | align 4 |
1133 | .next: |
1133 | .next: |
1134 | xor edx, edx |
1134 | xor edx, edx |
1135 | div ecx |
1135 | div ecx |
1136 | dec esi |
1136 | dec esi |
1137 | mov dl, [edx + .digits]; (put digit |
1137 | mov dl, [edx + .digits]; (put digit |
1138 | mov [esi], dl ; to buffer) |
1138 | mov [esi], dl ; to buffer) |
1139 | test eax, eax |
1139 | test eax, eax |
1140 | jnz .next |
1140 | jnz .next |
1141 | ; shift result string to buffer beginning |
1141 | ; shift result string to buffer beginning |
1142 | mov eax, esi |
1142 | mov eax, esi |
1143 | sub eax, edi |
1143 | sub eax, edi |
1144 | mov ecx, 32 + 1 |
1144 | mov ecx, 32 + 1 |
1145 | sub ecx, eax |
1145 | sub ecx, eax |
1146 | mov eax, edi ; return buffer |
1146 | mov eax, edi ; return buffer |
1147 | ; yes, memory overlapped, but edi not above than esi |
1147 | ; yes, memory overlapped, but edi not above than esi |
1148 | ; hope that movsD faster than movsB in this case |
1148 | ; hope that movsD faster than movsB in this case |
1149 | ; if you want only "rep movsb" because it shorter then remove five next lines before "rep movsb" |
1149 | ; if you want only "rep movsb" because it shorter then remove five next lines before "rep movsb" |
1150 | mov edx, ecx |
1150 | mov edx, ecx |
1151 | shr ecx, 2 |
1151 | shr ecx, 2 |
1152 | and edx, 3 |
1152 | and edx, 3 |
1153 | rep movsd |
1153 | rep movsd |
1154 | mov ecx, edx |
1154 | mov ecx, edx |
1155 | rep movsb |
1155 | rep movsb |
1156 | ret 12 |
1156 | ret 12 |
1157 | %undef value |
1157 | %undef value |
1158 | %undef base |
1158 | %undef base |
1159 | %undef buffer |
1159 | %undef buffer |
1160 | align 4 |
1160 | align 4 |
1161 | .digits db "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ" |
1161 | .digits db "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ" |
1162 | ; ---------------------------------------------------------------------------- ; |
1162 | ; ---------------------------------------------------------------------------- ; |
1163 | align 4 |
1163 | align 4 |
1164 | PadBuffSpaces: |
1164 | PadBuffSpaces: |
1165 | %define maxlen [esp + 4] |
1165 | %define maxlen [esp + 4] |
1166 | mov edi, tmpbuffer |
1166 | mov edi, tmpbuffer |
1167 | or ecx, -1 |
1167 | or ecx, -1 |
1168 | xor eax, eax |
1168 | xor eax, eax |
1169 | repne scasb |
1169 | repne scasb |
1170 | dec edi |
1170 | dec edi |
1171 | sub eax, ecx |
1171 | sub eax, ecx |
1172 | dec eax |
1172 | dec eax |
1173 | mov ecx, maxlen |
1173 | mov ecx, maxlen |
1174 | sub ecx, eax |
1174 | sub ecx, eax |
1175 | mov eax, " " |
1175 | mov eax, " " |
1176 | mov edx, ecx |
1176 | mov edx, ecx |
1177 | shr ecx, 2 |
1177 | shr ecx, 2 |
1178 | and edx, 3 |
1178 | and edx, 3 |
1179 | rep stosd |
1179 | rep stosd |
1180 | mov ecx, edx |
1180 | mov ecx, edx |
1181 | rep stosb |
1181 | rep stosb |
1182 | mov [edi], byte 0 |
1182 | mov [edi], byte 0 |
1183 | ret 4 |
1183 | ret 4 |
1184 | %undef maxlen |
1184 | %undef maxlen |
1185 | ; ---------------------------------------------------------------------------- ; |
1185 | ; ---------------------------------------------------------------------------- ; |
1186 | align 4 |
1186 | align 4 |
1187 | END:=>=>><>><>><>><>><>><>><> |
1187 | END:=>=>><>><>><>><>><>><>><> |