From 2e3548d92acbf715ff185313bbb86cb547992a12 Mon Sep 17 00:00:00 2001 From: IgorA Date: Sat, 1 Mar 2025 12:50:13 +0200 Subject: [PATCH] Apps/tinfo: Rewrite from nasm to fasm --- data/Tupfile.lua | 2 +- programs/system/tinfo/Tupfile.lua | 9 +- programs/system/tinfo/build_en.bat | 4 + programs/system/tinfo/build_ru.bat | 4 + programs/system/tinfo/make.bat | 1 - programs/system/tinfo/tinfo.asm | 1120 ++++++++++------------------ 6 files changed, 423 insertions(+), 717 deletions(-) create mode 100644 programs/system/tinfo/build_en.bat create mode 100644 programs/system/tinfo/build_ru.bat delete mode 100644 programs/system/tinfo/make.bat diff --git a/data/Tupfile.lua b/data/Tupfile.lua index 4e92f48dd..d26b4a831 100644 --- a/data/Tupfile.lua +++ b/data/Tupfile.lua @@ -441,6 +441,7 @@ tup.append_table(img_files, { {"TERMINAL", VAR_PROGS .. "/system/terminal/terminal"}, {"TEST", VAR_PROGS .. "/testing/protection/trunk/test"}, {"TINYPAD", VAR_PROGS .. "/develop/tinypad/trunk/tinypad"}, + {"TINFO", VAR_PROGS .. "/system/tinfo/tinfo"}, {"UNZ", VAR_PROGS .. "/fs/unz/unz"}, {"ZKEY", VAR_PROGS .. "/system/zkey/trunk/ZKEY"}, {"3D/3DWAV", VAR_PROGS .. "/demos/3dwav/trunk/3dwav"}, @@ -647,7 +648,6 @@ tup.append_table(img_files, { {"ACLOCK", VAR_PROGS .. "/demos/aclock/trunk/aclock"}, {"LOD", VAR_PROGS .. "/fs/lod/lod"}, {"TIMER", VAR_PROGS .. "/other/Timer/timer"}, - {"TINFO", VAR_PROGS .. "/system/tinfo/tinfo"}, {"DEVELOP/GENFILES", VAR_PROGS .. "/testing/genfiles/GenFiles"}, {"MEDIA/FILLSCR", VAR_PROGS .. "/media/FillScr/fillscr"}, }) diff --git a/programs/system/tinfo/Tupfile.lua b/programs/system/tinfo/Tupfile.lua index d582246bc..45c75e8c7 100644 --- a/programs/system/tinfo/Tupfile.lua +++ b/programs/system/tinfo/Tupfile.lua @@ -1,2 +1,7 @@ -if tup.getconfig("NO_NASM") ~= "" then return end -tup.rule("tinfo.asm", "nasm -f bin -o %o %f " .. tup.getconfig("KPACK_CMD"), "tinfo") +if tup.getconfig("NO_FASM") ~= "" then return end +HELPERDIR = (tup.getconfig("HELPERDIR") == "") and "../.." or tup.getconfig("HELPERDIR") +tup.include(HELPERDIR .. "/use_fasm.lua") +add_include(tup.getvariantdir()) + +tup.rule("echo lang fix " .. ((tup.getconfig("LANG") == "") and "en_US" or tup.getconfig("LANG")) .. " > %o", {"lang.inc"}) +tup.rule({"tinfo.asm", extra_inputs = {"lang.inc"}}, FASM .. " %f %o " .. tup.getconfig("KPACK_CMD"), "tinfo") diff --git a/programs/system/tinfo/build_en.bat b/programs/system/tinfo/build_en.bat new file mode 100644 index 000000000..9593fe1f3 --- /dev/null +++ b/programs/system/tinfo/build_en.bat @@ -0,0 +1,4 @@ +@echo lang fix en_EN >lang.inc +@fasm.exe -m 16384 tinfo.asm tinfo.kex +@kpack tinfo.kex +pause diff --git a/programs/system/tinfo/build_ru.bat b/programs/system/tinfo/build_ru.bat new file mode 100644 index 000000000..9094662e3 --- /dev/null +++ b/programs/system/tinfo/build_ru.bat @@ -0,0 +1,4 @@ +@echo lang fix ru_RU >lang.inc +@fasm.exe -m 16384 tinfo.asm tinfo.kex +@kpack tinfo.kex +pause diff --git a/programs/system/tinfo/make.bat b/programs/system/tinfo/make.bat deleted file mode 100644 index 62295c0e0..000000000 --- a/programs/system/tinfo/make.bat +++ /dev/null @@ -1 +0,0 @@ -nasm -f bin tinfo.asm -o tinfo \ No newline at end of file diff --git a/programs/system/tinfo/tinfo.asm b/programs/system/tinfo/tinfo.asm index c7fb4fff9..4e3e7a15d 100644 --- a/programs/system/tinfo/tinfo.asm +++ b/programs/system/tinfo/tinfo.asm @@ -2,96 +2,106 @@ ; usage: tinfo [slot of the thread] ; ; if slot number is omitted then assume slot = -1 ; ; to compile: nasm -f bin tinfo.asm -o tinfo ; -ORG 0 -BITS 32 + +use32 + org 0 + db 'MENUET01' +version dd 1 + dd program.start + dd program.end + dd program.memory + dd program.stack + dd program.params + dd program.path + +include '../../macros.inc' +include '../../proc32.inc' +include '../../KOSfuncs.inc' +include 'lang.inc' + ; ---------------------------------------------------------------------------- ; -PATH_SIZE equ 1024 -PARAMS_SIZE equ 256 -STACK_SIZE equ 256 -PROC_INFO_SIZE equ 1024 -TMP_BUFFER_SIZE equ 64 +TEXT_WIDTH = 8 +BOLD_TEXT_WIDTH = TEXT_WIDTH + 1 ; ---------------------------------------------------------------------------- ; -TEXT_WIDTH equ 8 -BOLD_TEXT_WIDTH equ TEXT_WIDTH + 1 +if lang eq ru_RU +COLUMN1_MAX_COUNT = 19 +COLUMN2_MAX_COUNT = 12 +COLUMN3_MAX_COUNT = 26 +else +COLUMN1_MAX_COUNT = 13 +COLUMN2_MAX_COUNT = 12 +COLUMN3_MAX_COUNT = 26 +end if ; ---------------------------------------------------------------------------- ; -COLUMN1_MAX_COUNT equ 13 -COLUMN2_MAX_COUNT equ 12 -COLUMN3_MAX_COUNT equ 26 +COLUMN_PADDING = 3 +COLUMN1_PADDING = COLUMN_PADDING +COLUMN2_PADDING = COLUMN_PADDING +COLUMN3_PADDING = COLUMN_PADDING ; ---------------------------------------------------------------------------- ; -COLUMN_PADDING equ 3 -COLUMN1_PADDING equ COLUMN_PADDING -COLUMN2_PADDING equ COLUMN_PADDING -COLUMN3_PADDING equ COLUMN_PADDING +ITEM_HEIGHT = 22 +TEXT_HEIGHT = 16 +;COLUMN1_ITEM_WIDTH = COLUMN1_MAX_COUNT * BOLD_TEXT_WIDTH + COLUMN1_PADDING * 2 +;COLUMN2_ITEM_WIDTH = COLUMN2_MAX_COUNT * BOLD_TEXT_WIDTH + COLUMN2_PADDING * 2 +;COLUMN3_ITEM_WIDTH = COLUMN3_MAX_COUNT * BOLD_TEXT_WIDTH + COLUMN3_PADDING * 2 +COLUMN1_ITEM_WIDTH = COLUMN1_MAX_COUNT * TEXT_WIDTH + COLUMN1_PADDING * 2 +COLUMN2_ITEM_WIDTH = COLUMN2_MAX_COUNT * TEXT_WIDTH + COLUMN2_PADDING * 2 +COLUMN3_ITEM_WIDTH = COLUMN3_MAX_COUNT * TEXT_WIDTH + COLUMN3_PADDING * 2 +ITEM_MARGIN = 6 +ITEM_BACK_COLOR_1 = 0x00EAEAEA +ITEM_BACK_COLOR_2 = 0x00F4F4F4 +ITEM_COUNT = 18 ; at current time we have 18 items ; ---------------------------------------------------------------------------- ; -ITEM_HEIGHT equ 22 -TEXT_HEIGHT equ 16 -%IF 0 -COLUMN1_ITEM_WIDTH equ COLUMN1_MAX_COUNT * BOLD_TEXT_WIDTH + COLUMN1_PADDING * 2 -COLUMN2_ITEM_WIDTH equ COLUMN2_MAX_COUNT * BOLD_TEXT_WIDTH + COLUMN2_PADDING * 2 -COLUMN3_ITEM_WIDTH equ COLUMN3_MAX_COUNT * BOLD_TEXT_WIDTH + COLUMN3_PADDING * 2 -%ENDIF -COLUMN1_ITEM_WIDTH equ COLUMN1_MAX_COUNT * TEXT_WIDTH + COLUMN1_PADDING * 2 -COLUMN2_ITEM_WIDTH equ COLUMN2_MAX_COUNT * TEXT_WIDTH + COLUMN2_PADDING * 2 -COLUMN3_ITEM_WIDTH equ COLUMN3_MAX_COUNT * TEXT_WIDTH + COLUMN3_PADDING * 2 -ITEM_MARGIN equ 6 -ITEM_BACK_COLOR_1 equ 0x00EAEAEA -ITEM_BACK_COLOR_2 equ 0x00F4F4F4 -ITEM_COUNT equ 18 ; at current time we have 18 items +COLUMN_Y = 10 +COLUMN1_X = 10 +COLUMN2_X = COLUMN1_X + COLUMN1_ITEM_WIDTH + ITEM_MARGIN +COLUMN3_X = COLUMN2_X + COLUMN2_ITEM_WIDTH + ITEM_MARGIN ; ---------------------------------------------------------------------------- ; -COLUMN_Y equ 10 -COLUMN1_X equ 10 -COLUMN2_X equ COLUMN1_X + COLUMN1_ITEM_WIDTH + ITEM_MARGIN -COLUMN3_X equ COLUMN2_X + COLUMN2_ITEM_WIDTH + ITEM_MARGIN +COLUMN1_TEXT_X = COLUMN1_X + COLUMN1_PADDING +COLUMN2_TEXT_X = COLUMN2_X + COLUMN2_PADDING +COLUMN3_TEXT_X = COLUMN3_X + COLUMN3_PADDING ; ---------------------------------------------------------------------------- ; -COLUMN1_TEXT_X equ COLUMN1_X + COLUMN1_PADDING -COLUMN2_TEXT_X equ COLUMN2_X + COLUMN2_PADDING -COLUMN3_TEXT_X equ COLUMN3_X + COLUMN3_PADDING +FRAME_TOP = COLUMN_Y - ITEM_MARGIN / 2 +FRAME_BOTTOM = COLUMN_Y + ITEM_HEIGHT * ITEM_COUNT + ITEM_MARGIN / 2 - 1 ; ---------------------------------------------------------------------------- ; -FRAME_TOP equ COLUMN_Y - ITEM_MARGIN / 2 -FRAME_BOTTOM equ COLUMN_Y + ITEM_HEIGHT * ITEM_COUNT + ITEM_MARGIN / 2 - 1 - ; ---------------------------------------------------------------------------- ; -FRAME1_LEFT equ COLUMN1_X - ITEM_MARGIN / 2 -FRAME1_RIGHT equ COLUMN1_X + COLUMN1_ITEM_WIDTH + ITEM_MARGIN / 2 - 1 +FRAME1_LEFT = COLUMN1_X - ITEM_MARGIN / 2 +FRAME1_RIGHT = COLUMN1_X + COLUMN1_ITEM_WIDTH + ITEM_MARGIN / 2 - 1 ; ---------------------------------------------------------------------------- ; -FRAME2_LEFT equ COLUMN2_X - ITEM_MARGIN / 2 -FRAME2_RIGHT equ COLUMN2_X + COLUMN2_ITEM_WIDTH + ITEM_MARGIN / 2 - 1 +FRAME2_LEFT = COLUMN2_X - ITEM_MARGIN / 2 +FRAME2_RIGHT = COLUMN2_X + COLUMN2_ITEM_WIDTH + ITEM_MARGIN / 2 - 1 ; ---------------------------------------------------------------------------- ; -FRAME3_LEFT equ COLUMN3_X - ITEM_MARGIN / 2 -FRAME3_RIGHT equ COLUMN3_X + COLUMN3_ITEM_WIDTH + ITEM_MARGIN / 2 - 1 +FRAME3_LEFT = COLUMN3_X - ITEM_MARGIN / 2 +FRAME3_RIGHT = COLUMN3_X + COLUMN3_ITEM_WIDTH + ITEM_MARGIN / 2 - 1 ; ---------------------------------------------------------------------------- ; -WINDOW_STYLE_SKINNED_FIXED equ 0x4000000 -WINDOW_STYLE_COORD_CLIENT equ 0x20000000 -WINDOW_STYLE_CAPTION equ 0x10000000 +WINDOW_STYLE_SKINNED_FIXED = 0x4000000 +WINDOW_STYLE_COORD_CLIENT = 0x20000000 +WINDOW_STYLE_CAPTION = 0x10000000 ; ---------------------------------------------------------------------------- ; -WINDOW_BORDER_SIZE equ 5 -WINDOW_WIDTH equ FRAME3_RIGHT + FRAME1_LEFT + WINDOW_BORDER_SIZE * 2 -WINDOW_STYLE equ WINDOW_STYLE_SKINNED_FIXED | WINDOW_STYLE_COORD_CLIENT | WINDOW_STYLE_CAPTION -WINDOW_BACK_COLOR equ 0x00FFFFFF +WINDOW_BORDER_SIZE = 5 +WINDOW_WIDTH = FRAME3_RIGHT + FRAME1_LEFT + WINDOW_BORDER_SIZE * 2 +WINDOW_STYLE = WINDOW_STYLE_SKINNED_FIXED or WINDOW_STYLE_COORD_CLIENT or WINDOW_STYLE_CAPTION +WINDOW_BACK_COLOR = 0x00FFFFFF ; ---------------------------------------------------------------------------- ; -INDICATOR_WIDTH equ 3 -INDICATOR_HEIGHT equ 3 -INDICATOR_LEFT equ COLUMN3_X + COLUMN3_ITEM_WIDTH + ITEM_MARGIN / 2 -INDICATOR_TOP equ COLUMN_Y - ITEM_MARGIN / 2 - INDICATOR_HEIGHT +INDICATOR_WIDTH = 3 +INDICATOR_HEIGHT = 3 +INDICATOR_LEFT = COLUMN3_X + COLUMN3_ITEM_WIDTH + ITEM_MARGIN / 2 +INDICATOR_TOP = COLUMN_Y - ITEM_MARGIN / 2 - INDICATOR_HEIGHT ; ---------------------------------------------------------------------------- ; -UPDATE_TIME equ 28 +UPDATE_TIME = 28 ; ---------------------------------------------------------------------------- ; -thread_info equ END + PATH_SIZE + PARAMS_SIZE -tmpbuffer equ END + PATH_SIZE + PARAMS_SIZE + PROC_INFO_SIZE +KEYBOARD_MODE_ASCII = 0 +KEYBOARD_MODE_SCAN = 1 ; ---------------------------------------------------------------------------- ; -KEYBOARD_MODE_ASCII equ 0 -KEYBOARD_MODE_SCAN equ 1 +WINDOW_STATE_MAXIMIZED = 1 +WINDOW_STATE_MINIMIZED = 2 +WINDOW_STATE_ROLLED_UP = 4 ; ---------------------------------------------------------------------------- ; -WINDOW_STATE_MAXIMIZED equ 1 -WINDOW_STATE_MINIMIZED equ 2 -WINDOW_STATE_ROLLED_UP equ 4 -; ---------------------------------------------------------------------------- ; -THREAD_STATE_RUNNING equ 0 -THREAD_STATE_SUSPENDED equ 1 -THREAD_STATE_SUSPENDED_WAIT_EVENT equ 2 -THREAD_STATE_NORMAL_TERMINATING equ 3 -THREAD_STATE_EXCEPT_TERMINATING equ 4 -THREAD_STATE_WAIT_EVENT equ 5 -THREAD_STATE_SLOT_IS_FREE equ 9 +THREAD_STATE_RUNNING = 0 +THREAD_STATE_SUSPENDED = 1 +THREAD_STATE_SUSPENDED_WAIT_EVENT = 2 +THREAD_STATE_NORMAL_TERMINATING = 3 +THREAD_STATE_EXCEPT_TERMINATING = 4 +THREAD_STATE_WAIT_EVENT = 5 +THREAD_STATE_SLOT_IS_FREE = 9 ; ---------------------------------------------------------------------------- ; EM_REDRAW equ 1b EM_KEY equ 10b @@ -102,40 +112,33 @@ EM_MOUSE equ 100000b EM_IPC equ 1000000b EM_NETWORK equ 10000000b EM_DEBUG equ 100000000b + ; ---------------------------------------------------------------------------- ; -struc THREAD_INFO - .cpu_usage resd 1 ; usage of the processor - .win_stack_pos resw 1 ; position of the window of thread in the window stack - .reserved0 resw 1 ; has no relation to the specified thread - .reserved1 resw 1 ; reserved - .name resb 11 ; name of the started file - executable file without extension - .reserved2 resb 1 ; reserved, this byte is not changed - .mem_address resd 1 ; address of the process in memory - .mem_usage resd 1 ; size of used memory - 1 - .identifier resd 1 ; identifier (PID/TID) - .x resd 1 ; coordinate of the thread window on axis x - .y resd 1 ; coordinate of the thread window on axis y - .size_x resd 1 ; size of the thread window on axis x - .size_y resd 1 ; size of the thread window on axis y - .thread_state resw 1 ; status of the thread slot - .reserved3 resw 1 ; reserved, this word is not changed - .client_x resd 1 ; coordinate of the client area on axis x - .client_y resd 1 ; coordinate of the client area on axis y - .client_size_x resd 1 ; width of the client area - .client_size_y resd 1 ; height of the client area - .window_state resb 1 ; state of the window - bitfield - .event_mask resd 1 ; event mask - .keyboard_mode resb 1 ; keyboard mode -endstruc -; ---------------------------------------------------------------------------- ; -MENUET01 db 'MENUET01' -version dd 1 -program.start dd START -program.end dd END -program.memory dd END + PATH_SIZE + PARAMS_SIZE + PROC_INFO_SIZE + TMP_BUFFER_SIZE + STACK_SIZE -program.stack dd END + PATH_SIZE + PARAMS_SIZE + PROC_INFO_SIZE + TMP_BUFFER_SIZE + STACK_SIZE -program.params dd END + PATH_SIZE -program.path dd END +struct THREAD_INFO + cpu_usage rd 1 ; usage of the processor + win_stack_pos rw 1 ; position of the window of thread in the window stack + reserved0 rw 1 ; has no relation to the specified thread + reserved1 rw 1 ; reserved + name rb 11 ; name of the started file - executable file without extension + reserved2 rb 1 ; reserved, this byte is not changed + mem_address rd 1 ; address of the process in memory + mem_usage rd 1 ; size of used memory - 1 + identifier rd 1 ; identifier (PID/TID) + x rd 1 ; coordinate of the thread window on axis x + y rd 1 ; coordinate of the thread window on axis y + size_x rd 1 ; size of the thread window on axis x + size_y rd 1 ; size of the thread window on axis y + thread_state rw 1 ; status of the thread slot + reserved3 rw 1 ; reserved, this word is not changed + client_x rd 1 ; coordinate of the client area on axis x + client_y rd 1 ; coordinate of the client area on axis y + client_size_x rd 1 ; width of the client area + client_size_y rd 1 ; height of the client area + window_state rb 1 ; state of the window - bitfield + event_mask rd 1 ; event mask + keyboard_mode rb 1 ; keyboard mode +ends + ; ---------------------------------------------------------------------------- ; slot dd -1 ; for default if no params ; ---------------------------------------------------------------------------- ; @@ -163,14 +166,33 @@ IndicatorColors: dd 0x000AF000 dd 0x00000FA0 ; ---------------------------------------------------------------------------- ; -%define x [Pos.x] -%define y [Pos.y] +align 4 Pos: .x dd COLUMN1_X .y dd COLUMN_Y ; ---------------------------------------------------------------------------- ; sz_caption db "ThreadInfo",0 ; ---------------------------------------------------------------------------- ; +if lang eq ru_RU +sz_cpu_usage db "Использ. процессора",0 +sz_win_stack_pos db "Win stack pos",0 +sz_name db "Имя",0 +sz_mem_address db "Адрес в памяти",0 +sz_mem_usage db "Использовано памяти",0 +sz_identifier db "Идентификатор",0 +sz_x db "X",0 +sz_y db "Y",0 +sz_size_x db "Размер X",0 +sz_size_y db "Размер Y",0 +sz_thread_state db "Состояние процесса",0 +sz_client_x db "Client X",0 +sz_client_y db "Client Y",0 +sz_client_size_x db "Client Size X",0 +sz_client_size_y db "Client Size Y",0 +sz_window_state db "Состояние окна",0 +sz_event_mask db "Маска событий",0 +sz_keyboard_mode db "Режим клавиатуры",0 +else sz_cpu_usage db "CPU usage",0 sz_win_stack_pos db "Win stack pos",0 sz_name db "Name",0 @@ -189,6 +211,7 @@ sz_client_size_y db "Client Size Y",0 sz_window_state db "Window state",0 sz_event_mask db "Event mask",0 sz_keyboard_mode db "Keyboard mode",0 +end if ; ---------------------------------------------------------------------------- ; ; state of the window sz_maximized db "Max ",0 @@ -221,645 +244,359 @@ sz_debug db "dbg ",0 ; ---------------------------------------------------------------------------- ; sz_undefined db "UnDef ",0 ; **************************************************************************** ; -%macro DrawCpuUsage 0 +macro DrawCpuUsage { ; sz_cpu_usage - push dword COLUMN1_TEXT_X - push dword y - push dword sz_cpu_usage - push dword [fore_color] - push dword [back_color] - call DrawText + stdcall DrawText, [back_color],[fore_color],sz_cpu_usage,[Pos.y],COLUMN1_TEXT_X ; [cpu_usage] - push dword [thread_info + THREAD_INFO.cpu_usage] - call uint2str - push dword COLUMN2_MAX_COUNT - call PadBuffSpaces - push dword COLUMN2_TEXT_X - push dword y - push dword tmpbuffer - push dword [fore_color] - push dword [back_color] - call DrawText + stdcall uint2str, [thread_info + THREAD_INFO.cpu_usage] + stdcall PadBuffSpaces, COLUMN2_MAX_COUNT + stdcall DrawText, [back_color],[fore_color],tmpbuffer,[Pos.y],COLUMN2_TEXT_X call ChangeBackColor - add y, dword ITEM_HEIGHT -%endmacro + add [Pos.y], dword ITEM_HEIGHT +} ; **************************************************************************** ; -%macro DrawWinStackPos 0 +macro DrawWinStackPos { ; sz_win_stack_pos - push dword COLUMN1_TEXT_X - push dword y - push dword sz_win_stack_pos - push dword [fore_color] - push dword [back_color] - call DrawText + stdcall DrawText, [back_color],[fore_color],sz_win_stack_pos,[Pos.y],COLUMN1_TEXT_X ; [win_stack_pos] movzx eax, word [thread_info + THREAD_INFO.win_stack_pos] - push eax - call uint2str - push dword COLUMN2_MAX_COUNT - call PadBuffSpaces - push dword COLUMN2_TEXT_X - push dword y - push dword tmpbuffer - push dword [fore_color] - push dword [back_color] - call DrawText + stdcall uint2str, eax + stdcall PadBuffSpaces, COLUMN2_MAX_COUNT + stdcall DrawText, [back_color],[fore_color],tmpbuffer,[Pos.y],COLUMN2_TEXT_X call ChangeBackColor - add y, dword ITEM_HEIGHT -%endmacro + add [Pos.y], dword ITEM_HEIGHT +} ; **************************************************************************** ; -%macro DrawName 0 +macro DrawName { ; sz_name - push dword COLUMN1_TEXT_X - push dword y - push dword sz_name - push dword [fore_color] - push dword [back_color] - call DrawText + stdcall DrawText, [back_color],[fore_color],sz_name,[Pos.y],COLUMN1_TEXT_X ; name - push dword COLUMN2_TEXT_X - push dword y - push dword (thread_info + THREAD_INFO.name) - push dword [fore_color] - push dword [back_color] - call DrawText + stdcall DrawText, [back_color],[fore_color],(thread_info + THREAD_INFO.name),[Pos.y],COLUMN2_TEXT_X call ChangeBackColor - add y, dword ITEM_HEIGHT -%endmacro + add [Pos.y], dword ITEM_HEIGHT +} ; **************************************************************************** ; -%macro DrawMemAddress 0 +macro DrawMemAddress { ; sz_mem_address - push dword COLUMN1_TEXT_X - push dword y - push dword sz_mem_address - push dword [fore_color] - push dword [back_color] - call DrawText + stdcall DrawText, [back_color],[fore_color],sz_mem_address,[Pos.y],COLUMN1_TEXT_X ; [mem_address] - push dword [thread_info + THREAD_INFO.mem_address] - call uint2str - push dword COLUMN2_MAX_COUNT - call PadBuffSpaces - push dword COLUMN2_TEXT_X - push dword y - push dword tmpbuffer - push dword [fore_color] - push dword [back_color] - call DrawText + stdcall uint2str, [thread_info + THREAD_INFO.mem_address] + stdcall PadBuffSpaces, COLUMN2_MAX_COUNT + stdcall DrawText, [back_color],[fore_color],tmpbuffer,[Pos.y],COLUMN2_TEXT_X call ChangeBackColor - add y, dword ITEM_HEIGHT -%endmacro + add [Pos.y], dword ITEM_HEIGHT +} ; **************************************************************************** ; -%macro DrawMemUsage 0 +macro DrawMemUsage { ; sz_mem_usage - push dword COLUMN1_TEXT_X - push dword y - push dword sz_mem_usage - push dword [fore_color] - push dword [back_color] - call DrawText + stdcall DrawText, [back_color],[fore_color],sz_mem_usage,[Pos.y],COLUMN1_TEXT_X ; [mem_usage] - push dword [thread_info + THREAD_INFO.mem_usage] - call uint2str - push dword COLUMN2_MAX_COUNT - call PadBuffSpaces - push dword COLUMN2_TEXT_X - push dword y - push dword tmpbuffer - push dword [fore_color] - push dword [back_color] - call DrawText + stdcall uint2str, [thread_info + THREAD_INFO.mem_usage] + stdcall PadBuffSpaces, COLUMN2_MAX_COUNT + stdcall DrawText, [back_color],[fore_color],tmpbuffer,[Pos.y],COLUMN2_TEXT_X call ChangeBackColor - add y, dword ITEM_HEIGHT -%endmacro + add [Pos.y], dword ITEM_HEIGHT +} ; **************************************************************************** ; -%macro DrawIdentifier 0 +macro DrawIdentifier { ; sz_identifier - push dword COLUMN1_TEXT_X - push dword y - push dword sz_identifier - push dword [fore_color] - push dword [back_color] - call DrawText + stdcall DrawText, [back_color],[fore_color],sz_identifier,[Pos.y],COLUMN1_TEXT_X ; [identifier] - push dword [thread_info + THREAD_INFO.identifier] - call uint2str - push dword COLUMN2_MAX_COUNT - call PadBuffSpaces - push dword COLUMN2_TEXT_X - push dword y - push dword tmpbuffer - push dword [fore_color] - push dword [back_color] - call DrawText + stdcall uint2str, [thread_info + THREAD_INFO.identifier] + stdcall PadBuffSpaces, COLUMN2_MAX_COUNT + stdcall DrawText, [back_color],[fore_color],tmpbuffer,[Pos.y],COLUMN2_TEXT_X call ChangeBackColor - add y, dword ITEM_HEIGHT -%endmacro + add [Pos.y], dword ITEM_HEIGHT +} ; **************************************************************************** ; -%macro DrawWindowX 0 +macro DrawWindowX { ; sz_x - push dword COLUMN1_TEXT_X - push dword y - push dword sz_x - push dword [fore_color] - push dword [back_color] - call DrawText + stdcall DrawText, [back_color],[fore_color],sz_x,[Pos.y],COLUMN1_TEXT_X ; [x] - push dword [thread_info + THREAD_INFO.x] - call uint2str - push dword COLUMN2_MAX_COUNT - call PadBuffSpaces - push dword COLUMN2_TEXT_X - push dword y - push dword tmpbuffer - push dword [fore_color] - push dword [back_color] - call DrawText + stdcall uint2str, [thread_info + THREAD_INFO.x] + stdcall PadBuffSpaces, COLUMN2_MAX_COUNT + stdcall DrawText, [back_color],[fore_color],tmpbuffer,[Pos.y],COLUMN2_TEXT_X call ChangeBackColor - add y, dword ITEM_HEIGHT -%endmacro + add [Pos.y], dword ITEM_HEIGHT +} ; **************************************************************************** ; -%macro DrawWindowY 0 +macro DrawWindowY { ; sz_y - push dword COLUMN1_TEXT_X - push dword y - push dword sz_y - push dword [fore_color] - push dword [back_color] - call DrawText + stdcall DrawText, [back_color],[fore_color],sz_y,[Pos.y],COLUMN1_TEXT_X ; [y] - push dword [thread_info + THREAD_INFO.y] - call uint2str - push dword COLUMN2_MAX_COUNT - call PadBuffSpaces - push dword COLUMN2_TEXT_X - push dword y - push dword tmpbuffer - push dword [fore_color] - push dword [back_color] - call DrawText + stdcall uint2str, [thread_info + THREAD_INFO.y] + stdcall PadBuffSpaces, COLUMN2_MAX_COUNT + stdcall DrawText, [back_color],[fore_color],tmpbuffer,[Pos.y],COLUMN2_TEXT_X call ChangeBackColor - add y, dword ITEM_HEIGHT -%endmacro + add [Pos.y], dword ITEM_HEIGHT +} ; **************************************************************************** ; -%macro DrawWindowSizeX 0 +macro DrawWindowSizeX { ; sz_size_x - push dword COLUMN1_TEXT_X - push dword y - push dword sz_size_x - push dword [fore_color] - push dword [back_color] - call DrawText + stdcall DrawText, [back_color],[fore_color],sz_size_x,[Pos.y],COLUMN1_TEXT_X ; [size_x] - push dword [thread_info + THREAD_INFO.size_x] - call uint2str - push dword COLUMN2_MAX_COUNT - call PadBuffSpaces - push dword COLUMN2_TEXT_X - push dword y - push dword tmpbuffer - push dword [fore_color] - push dword [back_color] - call DrawText + stdcall uint2str, [thread_info + THREAD_INFO.size_x] + stdcall PadBuffSpaces, COLUMN2_MAX_COUNT + stdcall DrawText, [back_color],[fore_color],tmpbuffer,[Pos.y],COLUMN2_TEXT_X call ChangeBackColor - add y, dword ITEM_HEIGHT -%endmacro + add [Pos.y], dword ITEM_HEIGHT +} ; **************************************************************************** ; -%macro DrawWindowSizeY 0 +macro DrawWindowSizeY { ; sz_size_y - push dword COLUMN1_TEXT_X - push dword y - push dword sz_size_y - push dword [fore_color] - push dword [back_color] - call DrawText + stdcall DrawText, [back_color],[fore_color],sz_size_y,[Pos.y],COLUMN1_TEXT_X ; [size_y] - push dword [thread_info + THREAD_INFO.size_y] - call uint2str - push dword COLUMN2_MAX_COUNT - call PadBuffSpaces - push dword COLUMN2_TEXT_X - push dword y - push dword tmpbuffer - push dword [fore_color] - push dword [back_color] - call DrawText + stdcall uint2str, [thread_info + THREAD_INFO.size_y] + stdcall PadBuffSpaces, COLUMN2_MAX_COUNT + stdcall DrawText, [back_color],[fore_color],tmpbuffer,[Pos.y],COLUMN2_TEXT_X call ChangeBackColor - add y, dword ITEM_HEIGHT -%endmacro + add [Pos.y], dword ITEM_HEIGHT +} ; **************************************************************************** ; -%macro DrawThreadState 0 +macro DrawThreadState { ; sz_thread_state - push dword COLUMN1_TEXT_X - push dword y - push dword sz_thread_state - push dword [fore_color] - push dword [back_color] - call DrawText + stdcall DrawText, [back_color],[fore_color],sz_thread_state,[Pos.y],COLUMN1_TEXT_X ; decoded_thread_state & [thread_state] movzx eax, word [thread_info + THREAD_INFO.thread_state] push eax ; for "call uint2str" below -%%running: + cmp eax, THREAD_STATE_RUNNING - jne %%suspended + jne @f mov eax, sz_running jmp %%draw_decoded_thread_state -%%suspended: +@@: cmp eax, THREAD_STATE_SUSPENDED - jne %%suspended_w + jne @f mov eax, sz_suspended jmp %%draw_decoded_thread_state -%%suspended_w: +@@: cmp eax, THREAD_STATE_SUSPENDED_WAIT_EVENT - jne %%normal_term + jne @f mov eax, sz_suspended_wait_event jmp %%draw_decoded_thread_state -%%normal_term: +@@: cmp eax, THREAD_STATE_NORMAL_TERMINATING - jne %%except_term + jne @f mov eax, sz_normal_terminating jmp %%draw_decoded_thread_state -%%except_term: +@@: cmp eax, THREAD_STATE_EXCEPT_TERMINATING - jne %%wait_event + jne @f mov eax, sz_except_terminating jmp %%draw_decoded_thread_state -%%wait_event: +@@: cmp eax, THREAD_STATE_WAIT_EVENT - jne %%slot_free + jne @f mov eax, sz_wait_event jmp %%draw_decoded_thread_state -%%slot_free: +@@: cmp eax, THREAD_STATE_SLOT_IS_FREE - jne %%undefined + jne @f mov eax, sz_slot_is_free jmp %%draw_decoded_thread_state -%%undefined: +@@: mov eax, sz_undefined %%draw_decoded_thread_state: - push dword COLUMN3_TEXT_X - push dword y - push eax - push dword [fore_color] - push dword [back_color] - call DrawText + stdcall DrawText, [back_color],[fore_color],eax,[Pos.y],COLUMN3_TEXT_X call uint2str - push dword COLUMN2_MAX_COUNT - call PadBuffSpaces - push dword COLUMN2_TEXT_X - push dword y - push dword tmpbuffer - push dword [fore_color] - push dword [back_color] - call DrawText + stdcall PadBuffSpaces, COLUMN2_MAX_COUNT + stdcall DrawText, [back_color],[fore_color],tmpbuffer,[Pos.y],COLUMN2_TEXT_X call ChangeBackColor - add y, dword ITEM_HEIGHT -%endmacro + add [Pos.y], dword ITEM_HEIGHT +} ; **************************************************************************** ; -%macro DrawClientX 0 +macro DrawClientX { ; sz_client_x - push dword COLUMN1_TEXT_X - push dword y - push dword sz_client_x - push dword [fore_color] - push dword [back_color] - call DrawText + stdcall DrawText, [back_color],[fore_color],sz_client_x,[Pos.y],COLUMN1_TEXT_X ; [client_x] - push dword [thread_info + THREAD_INFO.client_x] - call uint2str - push dword COLUMN2_MAX_COUNT - call PadBuffSpaces - push dword COLUMN2_TEXT_X - push dword y - push dword tmpbuffer - push dword [fore_color] - push dword [back_color] - call DrawText + stdcall uint2str, [thread_info + THREAD_INFO.client_x] + stdcall PadBuffSpaces, COLUMN2_MAX_COUNT + stdcall DrawText, [back_color],[fore_color],tmpbuffer,[Pos.y],COLUMN2_TEXT_X call ChangeBackColor - add y, dword ITEM_HEIGHT -%endmacro + add [Pos.y], dword ITEM_HEIGHT +} ; **************************************************************************** ; -%macro DrawClientY 0 +macro DrawClientY { ; sz_client_y - push dword COLUMN1_TEXT_X - push dword y - push dword sz_client_y - push dword [fore_color] - push dword [back_color] - call DrawText + stdcall DrawText, [back_color],[fore_color],sz_client_y,[Pos.y],COLUMN1_TEXT_X ; [client_y] - push dword [thread_info + THREAD_INFO.client_y] - call uint2str - push dword COLUMN2_MAX_COUNT - call PadBuffSpaces - push dword COLUMN2_TEXT_X - push dword y - push dword tmpbuffer - push dword [fore_color] - push dword [back_color] - call DrawText + stdcall uint2str, [thread_info + THREAD_INFO.client_y] + stdcall PadBuffSpaces, COLUMN2_MAX_COUNT + stdcall DrawText, [back_color],[fore_color],tmpbuffer,[Pos.y],COLUMN2_TEXT_X call ChangeBackColor - add y, dword ITEM_HEIGHT -%endmacro + add [Pos.y], dword ITEM_HEIGHT +} ; **************************************************************************** ; -%macro DrawClientSizeX 0 +macro DrawClientSizeX { ; sz_client_size_x - push dword COLUMN1_TEXT_X - push dword y - push dword sz_client_size_x - push dword [fore_color] - push dword [back_color] - call DrawText + stdcall DrawText, [back_color],[fore_color],sz_client_size_x,[Pos.y],COLUMN1_TEXT_X ; [client_size_x] - push dword [thread_info + THREAD_INFO.client_size_x] - call uint2str - push dword COLUMN2_MAX_COUNT - call PadBuffSpaces - push dword COLUMN2_TEXT_X - push dword y - push dword tmpbuffer - push dword [fore_color] - push dword [back_color] - call DrawText + stdcall uint2str, [thread_info + THREAD_INFO.client_size_x] + stdcall PadBuffSpaces, COLUMN2_MAX_COUNT + stdcall DrawText, [back_color],[fore_color],tmpbuffer,[Pos.y],COLUMN2_TEXT_X call ChangeBackColor - add y, dword ITEM_HEIGHT -%endmacro + add [Pos.y], dword ITEM_HEIGHT +} ; **************************************************************************** ; -%macro DrawClientSizeY 0 +macro DrawClientSizeY { ; sz_client_size_y - push dword COLUMN1_TEXT_X - push dword y - push dword sz_client_size_y - push dword [fore_color] - push dword [back_color] - call DrawText + stdcall DrawText, [back_color],[fore_color],sz_client_size_y,[Pos.y],COLUMN1_TEXT_X ; [client_size_y] - push dword [thread_info + THREAD_INFO.client_size_y] - call uint2str - push dword COLUMN2_MAX_COUNT - call PadBuffSpaces - push dword COLUMN2_TEXT_X - push dword y - push dword tmpbuffer - push dword [fore_color] - push dword [back_color] - call DrawText + stdcall uint2str, [thread_info + THREAD_INFO.client_size_y] + stdcall PadBuffSpaces, COLUMN2_MAX_COUNT + stdcall DrawText, [back_color],[fore_color],tmpbuffer,[Pos.y],COLUMN2_TEXT_X call ChangeBackColor - add y, dword ITEM_HEIGHT -%endmacro + add [Pos.y], dword ITEM_HEIGHT +} ; **************************************************************************** ; -%macro DrawWindowState 0 +macro DrawWindowState { ; sz_window_state - push dword COLUMN1_TEXT_X - push dword y - push dword sz_window_state - push dword [fore_color] - push dword [back_color] - call DrawText + stdcall DrawText, [back_color],[fore_color],sz_window_state,[Pos.y],COLUMN1_TEXT_X ; decoded_window_state & [window_state] movzx eax, byte [thread_info + THREAD_INFO.window_state] push eax ; for "call uint2str" below mov ebx, eax mov [tmpbuffer], byte 0 -%%maximized: + test ebx, WINDOW_STATE_MAXIMIZED - jz %%minimized - push tmpbuffer - push sz_maximized - call StringConcatenate -%%minimized: + jz @f + stdcall StringConcatenate, sz_maximized,tmpbuffer +@@: test ebx, WINDOW_STATE_MINIMIZED - jz %%rolled_up - push tmpbuffer - push sz_minimized - call StringConcatenate -%%rolled_up: + jz @f + stdcall StringConcatenate, sz_minimized,tmpbuffer +@@: test ebx, WINDOW_STATE_ROLLED_UP - jz %%draw_decoded_window_state - push tmpbuffer - push sz_rolled_up - call StringConcatenate -%%draw_decoded_window_state: - push dword COLUMN3_MAX_COUNT - call PadBuffSpaces - push dword COLUMN3_TEXT_X - push dword y - push dword tmpbuffer - push dword [fore_color] - push dword [back_color] - call DrawText + jz @f + stdcall StringConcatenate, sz_rolled_up,tmpbuffer +@@: + stdcall PadBuffSpaces, COLUMN3_MAX_COUNT + stdcall DrawText, [back_color],[fore_color],tmpbuffer,[Pos.y],COLUMN3_TEXT_X call uint2str - push dword COLUMN2_MAX_COUNT - call PadBuffSpaces - push dword COLUMN2_TEXT_X - push dword y - push dword tmpbuffer - push dword [fore_color] - push dword [back_color] - call DrawText + stdcall PadBuffSpaces, COLUMN2_MAX_COUNT + stdcall DrawText, [back_color],[fore_color],tmpbuffer,[Pos.y],COLUMN2_TEXT_X call ChangeBackColor - add y, dword ITEM_HEIGHT -%endmacro + add [Pos.y], dword ITEM_HEIGHT +} ; **************************************************************************** ; -%macro DrawEventMask 0 +macro DrawEventMask { ; sz_event_mask - push dword COLUMN1_TEXT_X - push dword y - push dword sz_event_mask - push dword [fore_color] - push dword [back_color] - call DrawText + stdcall DrawText, [back_color],[fore_color],sz_event_mask,[Pos.y],COLUMN1_TEXT_X ; decoded_event_mask & [event_mask] mov eax, [thread_info + THREAD_INFO.event_mask] push eax ; for "call uint2str" below mov ebx, eax mov [tmpbuffer], byte 0 -%%redraw: test ebx, EM_REDRAW - jz %%key - push tmpbuffer - push sz_redraw - call StringConcatenate -%%key: + jz @f + stdcall StringConcatenate, sz_redraw,tmpbuffer +@@: test ebx, EM_KEY - jz %%button - push tmpbuffer - push sz_key - call StringConcatenate -%%button: + jz @f + stdcall StringConcatenate, sz_key,tmpbuffer +@@: test ebx, EM_BUTTON - jz %%reserved0 - push tmpbuffer - push sz_button - call StringConcatenate -%%reserved0: + jz @f + stdcall StringConcatenate, sz_button,tmpbuffer +@@: test ebx, EM_RESERVED0 - jz %%redraw_background - push tmpbuffer - push sz_reserved0 - call StringConcatenate -%%redraw_background: + jz @f + stdcall StringConcatenate, sz_reserved0,tmpbuffer +@@: test ebx, EM_REDRAW_BACKGROUND - jz %%mouse - push tmpbuffer - push sz_redraw_background - call StringConcatenate -%%mouse: + jz @f + stdcall StringConcatenate, sz_redraw_background,tmpbuffer +@@: test ebx, EM_MOUSE - jz %%ipc - push tmpbuffer - push sz_mouse - call StringConcatenate -%%ipc: + jz @f + stdcall StringConcatenate, sz_mouse,tmpbuffer +@@: test ebx, EM_IPC - jz %%network - push tmpbuffer - push sz_ipc - call StringConcatenate -%%network: + jz @f + stdcall StringConcatenate, sz_ipc,tmpbuffer +@@: test ebx, EM_NETWORK - jz %%debug - push tmpbuffer - push sz_network - call StringConcatenate -%%debug: + jz @f + stdcall StringConcatenate, sz_network,tmpbuffer +@@: test ebx, EM_DEBUG - jz %%draw_decoded_event_mask - push tmpbuffer - push sz_debug - call StringConcatenate -%%draw_decoded_event_mask: - push dword COLUMN3_MAX_COUNT - call PadBuffSpaces - push dword COLUMN3_TEXT_X - push dword y - push dword tmpbuffer - push dword [fore_color] - push dword [back_color] - call DrawText + jz @f + stdcall StringConcatenate, sz_debug,tmpbuffer +@@: + stdcall PadBuffSpaces, COLUMN3_MAX_COUNT + stdcall DrawText, [back_color],[fore_color],tmpbuffer,[Pos.y],COLUMN3_TEXT_X call uint2str - push dword COLUMN2_MAX_COUNT - call PadBuffSpaces - push dword COLUMN2_TEXT_X - push dword y - push dword tmpbuffer - push dword [fore_color] - push dword [back_color] - call DrawText + stdcall PadBuffSpaces, COLUMN2_MAX_COUNT + stdcall DrawText, [back_color],[fore_color],tmpbuffer,[Pos.y],COLUMN2_TEXT_X call ChangeBackColor - add y, dword ITEM_HEIGHT -%endmacro + add [Pos.y], dword ITEM_HEIGHT +} ; **************************************************************************** ; -%macro DrawKeyboardMode 0 - push dword COLUMN2_MAX_COUNT - call PadBuffSpaces +macro DrawKeyboardMode { + stdcall PadBuffSpaces, COLUMN2_MAX_COUNT ; sz_keyboard_mode - push dword COLUMN1_TEXT_X - push dword y - push dword sz_keyboard_mode - push dword [fore_color] - push dword [back_color] - call DrawText + stdcall DrawText, [back_color],[fore_color],sz_keyboard_mode,[Pos.y],COLUMN1_TEXT_X ; decoded_keyboard_mode & [keyboard_mode] movzx eax, byte [thread_info + THREAD_INFO.keyboard_mode] push eax ; for "call uint2str" below -%%ascii: + cmp eax, KEYBOARD_MODE_ASCII - jne %%scan + jne @f mov eax, sz_ascii jmp %%draw_decoded_keyboard_mode -%%scan: +@@: cmp eax, KEYBOARD_MODE_SCAN - jne %%undefined + jne @f mov eax, sz_scan jmp %%draw_decoded_keyboard_mode -%%undefined: +@@: mov eax, sz_undefined %%draw_decoded_keyboard_mode: - push dword COLUMN3_TEXT_X - push dword y - push eax - push dword [fore_color] - push dword [back_color] - call DrawText + stdcall DrawText, [back_color],[fore_color],eax,[Pos.y],COLUMN3_TEXT_X call uint2str - push dword COLUMN2_TEXT_X - push dword y - push dword tmpbuffer - push dword [fore_color] - push dword [back_color] - call DrawText + stdcall DrawText, [back_color],[fore_color],tmpbuffer,[Pos.y],COLUMN2_TEXT_X call ChangeBackColor - add y, dword ITEM_HEIGHT -%endmacro + add [Pos.y], dword ITEM_HEIGHT +} ; **************************************************************************** ; -%macro DrawUpdateIndicator 0 +macro DrawUpdateIndicator { mov eax, [IndicatorColors] sub eax, 3 neg eax mov [IndicatorColors], eax ; draw.rectangle mov edx, [eax * 4 + IndicatorColors] - mov eax, 13 - mov ebx, INDICATOR_LEFT << 16 | INDICATOR_WIDTH - mov ecx, INDICATOR_TOP << 16 | INDICATOR_HEIGHT - int 64 -%endmacro + mcall SF_DRAW_RECT, (INDICATOR_LEFT shl 16) or INDICATOR_WIDTH, (INDICATOR_TOP shl 16) or INDICATOR_HEIGHT +} ; **************************************************************************** ; -%macro DrawTable 0 +macro DrawTable { ; DrawFrames - push dword FRAME1_LEFT - push dword FRAME_TOP - push dword FRAME1_RIGHT - push dword FRAME_BOTTOM - push dword [frame_color] - call DrawFrame - push dword FRAME2_LEFT - push dword FRAME_TOP - push dword FRAME2_RIGHT - push dword FRAME_BOTTOM - push dword [frame_color] - call DrawFrame - push dword FRAME3_LEFT - push dword FRAME_TOP - push dword FRAME3_RIGHT - push dword FRAME_BOTTOM - push dword [frame_color] - call DrawFrame + stdcall DrawFrame, [frame_color],FRAME_BOTTOM,FRAME1_RIGHT,FRAME_TOP,FRAME1_LEFT + stdcall DrawFrame, [frame_color],FRAME_BOTTOM,FRAME2_RIGHT,FRAME_TOP,FRAME2_LEFT + stdcall DrawFrame, [frame_color],FRAME_BOTTOM,FRAME3_RIGHT,FRAME_TOP,FRAME3_LEFT ; DrawItems mov esi, COLUMN_Y xor edi, edi -%%draw_item: +@@: cmp edi, ITEM_COUNT - jnl %%done + jnl @f mov ecx, esi shl ecx, 16 or ecx, ITEM_HEIGHT -; draw.rectangle - mov eax, 13 - mov ebx, COLUMN1_X << 16 | COLUMN1_ITEM_WIDTH - mov edx, [back_color] - int 64 -; draw.rectangle - mov eax, 13 - mov ebx, COLUMN2_X << 16 | COLUMN2_ITEM_WIDTH - mov edx, [back_color] - int 64 -; draw.rectangle - mov eax, 13 - mov ebx, COLUMN3_X << 16 | COLUMN3_ITEM_WIDTH - mov edx, [back_color] - int 64 +; draw rectangles + mcall SF_DRAW_RECT, (COLUMN1_X shl 16) or COLUMN1_ITEM_WIDTH,, [back_color] + mcall , (COLUMN2_X shl 16) or COLUMN2_ITEM_WIDTH + mcall , (COLUMN3_X shl 16) or COLUMN3_ITEM_WIDTH call ChangeBackColor add esi, ITEM_HEIGHT inc edi - jmp %%draw_item -%%done: -%endmacro + jmp @b +@@: +} ; ---------------------------------------------------------------------------- ; align 4 -START: - mov esi, [program.params] +program.start: + mov esi, program.params test [esi], byte 0xFF jz .no_params ; str2uint(program.params) @@ -876,14 +613,10 @@ START: mov [slot], ecx .no_params: ; get.screen.size - mov eax, 61 - mov ebx, 1 - int 64 + mcall SF_GET_GRAPHICAL_PARAMS,SSF_SCREEN_SIZE mov [screen], eax ; skin.height - mov eax, 48 - mov ebx, 4 - int 64 + mcall SF_STYLE_SETTINGS,SSF_GET_SKIN_HEIGHT add eax, FRAME_BOTTOM + FRAME_TOP + WINDOW_BORDER_SIZE mov [window.width], dword WINDOW_WIDTH mov [window.height], eax @@ -896,39 +629,30 @@ START: mov [window.left], eax mov [window.top], edx ; set.event - mov eax, 40 - mov ebx, EM_REDRAW | EM_BUTTON - int 64 + mcall SF_SET_EVENTS_MASK, EM_REDRAW or EM_BUTTON ; ---------------------------------------------------------------------------- ; align 4 on_redraw: ; redraw.start - mov eax, 12 - mov ebx, 1 - int 64 + mcall SF_REDRAW,SSF_BEGIN_DRAW ; draw.window - xor eax, eax mov ebx, [window.left] mov ecx, [window.top] shl ebx, 16 shl ecx, 16 or ebx, [window.width] or ecx, [window.height] - mov edx, WINDOW_STYLE | WINDOW_BACK_COLOR + mov edx, WINDOW_STYLE or WINDOW_BACK_COLOR mov edi, sz_caption xor esi, esi - int 64 + mcall SF_CREATE_WINDOW ; redraw.finish - mov eax, 12 - mov ebx, 2 - int 64 + mcall SF_REDRAW,SSF_END_DRAW DrawTable call UpdateThreadInfo align 4 wait.event.by.time: - mov eax, 23 - mov ebx, UPDATE_TIME - int 64 + mcall SF_WAIT_EVENT_TIMEOUT,UPDATE_TIME dec eax jz on_redraw ; IF eax = 1 THEN redraw jns on_button ; ELSEIF eax = 2 THEN button @@ -936,19 +660,15 @@ wait.event.by.time: jmp wait.event.by.time align 4 on_button: ; terminate because we have only one button(close button) - or eax, -1 - int 64 + mcall SF_TERMINATE_PROCESS ; ---------------------------------------------------------------------------- ; align 4 UpdateThreadInfo: ; get.thread.info - mov eax, 9 - mov ebx, thread_info - mov ecx, [slot] - int 64 + mcall SF_THREAD_INFO, thread_info, [slot] - mov x, dword COLUMN1_X - mov y, dword COLUMN_Y + (ITEM_HEIGHT - TEXT_HEIGHT) / 2 + mov [Pos.x], dword COLUMN1_X + mov [Pos.y], dword COLUMN_Y + (ITEM_HEIGHT - TEXT_HEIGHT) / 2 mov [back_color], dword ITEM_BACK_COLOR_1 mov [BackColors], dword 1 ; order of next "Draw..." can be changed @@ -977,126 +697,96 @@ UpdateThreadInfo: ; ---------------------------------------------------------------------------- ; align 4 DrawFrame: -%define Color [esp + 4 +1*4] -%define Bottom [esp + 8 +1*4] -%define Top [esp + 16 +1*4] -%define Right [esp + 12 +1*4] -%define Left [esp + 20 +1*4] +Color equ [esp + 4 +4] +Bottom equ [esp + 8 +4] +Top equ [esp + 16 +4] +Right equ [esp + 12 +4] +Left equ [esp + 20 +4] push ebp - mov eax, 38 - mov edx, Color - mov esi, Bottom - mov edi, Top + mov edi, Top mov ebp, Right mov ebx, Left shl ebx, 16 mov bx, bp shrd ecx, edi, 16 mov cx, di - int 64 + mcall SF_DRAW_LINE,,, Color, Bottom shrd ecx, esi, 16 mov cx, si - int 64 + mcall shld esi, ebx, 16 mov bx, si shrd ecx, edi, 16 - int 64 + mcall shrd ebx, ebp, 16 mov bx, bp - int 64 + mcall pop ebp ret 20 -%undef Color -%undef Bottom -%undef Top -%undef Right -%undef Left +purge Color +purge Bottom +purge Top +purge Right +purge Left ; ---------------------------------------------------------------------------- ; align 4 -StringConcatenate: -%define stradd [esp + 4] -%define str [esp + 8] - mov esi, stradd +proc StringConcatenate, stradd:dword, str1:dword + mov esi, [stradd] or ecx, -1 mov edi, esi xor eax, eax repne scasb mov edx, ecx - mov edi, str + mov edi, [str1] repne scasb dec edi not edx - mov eax, str + mov eax, [str1] mov ecx, edx shr ecx, 2 and edx, 3 rep movsd mov ecx, edx rep movsb - ret 8 -%undef stradd -%undef str + ret +endp ; ---------------------------------------------------------------------------- ; align 4 -DrawText: -%define x [esp + 20] -%define y [esp + 16] -%define text [esp + 12] -%define fore_color [esp + 8] -%define back_color [esp + 4] - mov eax, 4 - mov ecx, fore_color - mov edi, back_color - mov edx, text - mov ebx, x +proc DrawText, b_color:dword, f_color:dword, text:dword, y:dword, x:dword + mov ebx, [x] shl ebx, 16 - or ebx, y + or ebx, [y] + mov ecx, [f_color] or ecx, 0xD0000000 - int 64 - ret 20 -%undef x -%undef y -%undef text -%undef fore_color -%undef back_color + mcall SF_DRAW_TEXT,,, [text],, [b_color] + ret +endp ; ---------------------------------------------------------------------------- ; -%IF 0 align 4 -DrawTextBold: -%define x [esp + 20] -%define y [esp + 16] -%define text [esp + 12] -%define fore_color [esp + 8] -%define back_color [esp + 4] - mov eax, 4 - mov ecx, fore_color - mov edi, back_color +proc DrawTextBold, b_color:dword, f_color:dword, text:dword, y:dword, x:dword + mov ecx, [f_color] + mov edi, [b_color] mov esi, 1 ; count - mov edx, text - mov ebx, x + mov edx, [text] + mov ebx, [x] shl ebx, 16 - or ebx, y + or ebx, [y] align 4 -.next: +@@: test [edx], byte 0xFF - jz .done + jz @f or ecx, 0x50000000 - int 64 - add ebx, (1 << 16) + mcall SF_DRAW_TEXT + add ebx, (1 shl 16) and ecx, 0x10FFFFFF - int 64 - add ebx, (TEXT_WIDTH << 16) + mcall + add ebx, (TEXT_WIDTH shl 16) inc edx - jmp .next + jmp @b align 4 -.done: - ret 20 -%undef x -%undef y -%undef text -%undef fore_color -%undef back_color -%ENDIF +@@: + ret +endp ; ---------------------------------------------------------------------------- ; align 4 ChangeBackColor: @@ -1110,19 +800,14 @@ ChangeBackColor: ; ---------------------------------------------------------------------------- ; align 4 uint2str: -%define value [esp + 4] - push dword value ; value - push dword 10 ; base(decimal) - push dword tmpbuffer ; buffer - call ConvertToBase + stdcall ConvertToBase, tmpbuffer,10,[esp + 4] ret 4 -%undef value ; ---------------------------------------------------------------------------- ; align 4 ConvertToBase: -%define value [esp + 12] ; value treated as unsigned -%define base [esp + 8] ; 2 <= base <= 36 -%define buffer [esp + 4] ; SizeOf(buffer) => (32 + 1) +value equ [esp + 12] ; value treated as unsigned +base equ [esp + 8] ; 2 <= base <= 36 +buffer equ [esp + 4] ; SizeOf(buffer) => (32 + 1) mov eax, value mov ecx, base mov esi, buffer @@ -1154,15 +839,15 @@ align 4 mov ecx, edx rep movsb ret 12 -%undef value -%undef base -%undef buffer +purge value +purge base +purge buffer align 4 .digits db "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ" ; ---------------------------------------------------------------------------- ; align 4 PadBuffSpaces: -%define maxlen [esp + 4] +maxlen equ [esp + 4] mov edi, tmpbuffer or ecx, -1 xor eax, eax @@ -1181,7 +866,16 @@ PadBuffSpaces: rep stosb mov [edi], byte 0 ret 4 -%undef maxlen +purge maxlen ; ---------------------------------------------------------------------------- ; align 4 -END: \ No newline at end of file +program.end: + program.path rb 1024 + program.params rb 256 +thread_info process_information + +tmpbuffer rb 64 + rb 512 +align 16 +program.stack: +program.memory: \ No newline at end of file