Subversion Repositories Kolibri OS

Rev

Rev 4966 | Go to most recent revision | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

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