From def6ce45779cf64fd5c3fad4ef75ce3f4175e087 Mon Sep 17 00:00:00 2001 From: "Kirill Lipatov (Leency)" Date: Wed, 3 Oct 2018 11:51:34 +0000 Subject: [PATCH] Calc: - fix unworkable hotkeys broken in r4588 - add hotkeys: A-F for HEX, Enter for getting result and Delete to resent number - instantly update display when press +,-,/,* Board: move boardlog.txt to /tmp0 Eskin: refactor and optimize code git-svn-id: svn://kolibrios.org@7431 a494cfbc-eb01-0410-851d-a64ba20cac60 --- programs/other/calc/trunk/calc.asm | 25 +++++++++++++++++-------- programs/system/board/trunk/board.asm | 2 +- programs/system/eskin/trunk/build.bat | 3 +++ programs/system/eskin/trunk/eskin.asm | 2 +- 4 files changed, 22 insertions(+), 10 deletions(-) create mode 100644 programs/system/eskin/trunk/build.bat diff --git a/programs/other/calc/trunk/calc.asm b/programs/other/calc/trunk/calc.asm index 8fdccd5404..8ae7452f39 100644 --- a/programs/other/calc/trunk/calc.asm +++ b/programs/other/calc/trunk/calc.asm @@ -35,6 +35,12 @@ include '../../../macros.inc' include '../../../gui_patterns.inc' include '../../../KOSfuncs.inc' +hotkeys_count equ 26 +asci: db 49, 50, 51, 52, 53, 54, 55, 56, 57, 48, 43, 61, 13, 45, 42, 47, 44, 46, 27, 182, \ + 97, 98, 99,100,101,102 +butid: db 12, 13, 14, 19, 20, 21, 26, 27, 28, 34, 15, 39, 39, 22, 36, 29, 35, 35, 1, 2 , \ + 6, 7, 8, 9, 10, 11 + START: red: call draw_window @@ -53,9 +59,10 @@ button: key: mcall 2 ; get ASCII key code + and eax, 0xffff ; supress scancodes shr eax, 8 mov edi, asci ; convert ASCII into button id - mov ecx, 18 + mov ecx, hotkeys_count cld repne scasb jne still @@ -261,6 +268,7 @@ no_sqrt: call calculate call new_entry mov [calc], '+' + call print_display jmp still no_add: @@ -269,6 +277,7 @@ no_add: call calculate call new_entry mov [calc], '-' + call print_display jmp still no_sub: @@ -277,6 +286,7 @@ no_sub: call calculate call new_entry mov [calc], '/' + call print_display jmp still no_div: @@ -285,6 +295,7 @@ no_div: call calculate mov [calc], '*' call new_entry + call print_display jmp still no_mul: @@ -704,6 +715,11 @@ next_button: cmp [edx], byte 'x' jne next_line + DrawRectangle3D DISPLAY_X-1,DISPLAY_Y-1,DISPLAY_W+2,DISPLAY_H+2, [sc.work_3d_dark], [sc.work_3d_light] + DrawRectangle DISPLAY_X,DISPLAY_Y,DISPLAY_W,DISPLAY_H, [sc.work_graph] + mcall 38, < DISPLAY_X+1, DISPLAY_W+DISPLAY_X-1>, , 0xE0E0E0 ; internal shadow + mcall , < DISPLAY_X+1, DISPLAY_X+1>, , ; internal shadow + call print_display mcall 12, 2 @@ -711,10 +727,6 @@ next_button: print_display: pusha - DrawRectangle3D DISPLAY_X-1,DISPLAY_Y-1,DISPLAY_W+2,DISPLAY_H+2, [sc.work_3d_dark], [sc.work_3d_light] - DrawRectangle DISPLAY_X,DISPLAY_Y,DISPLAY_W,DISPLAY_H, [sc.work_graph] - mcall 38, < DISPLAY_X+1, DISPLAY_W+DISPLAY_X-1>, , 0xE0E0E0 ; internal shadow - mcall , < DISPLAY_X+1, DISPLAY_X+1>, , ; internal shadow mcall 13, < DISPLAY_X+2, DISPLAY_W-2>, , 0xFFFfff ; background mcall 8, <236,53>, , 3, [sc.work] ; 'dec-bin-hex' @@ -840,9 +852,6 @@ text: db 3,'+/-', 1,'0', 1,'.', 1,'*', 3,'Sqr', 2,'Pi', 1,'=', 0 db 'x' -asci: db 49, 50, 51, 52, 53, 54, 55, 56, 57, 48, 43, 61, 45, 42, 47, 44, 46, 27 -butid: db 12, 13, 14, 19, 20, 21, 26, 27, 28, 34, 15, 39, 22, 36, 29, 35, 35, 1 - I_END: sc system_colors diff --git a/programs/system/board/trunk/board.asm b/programs/system/board/trunk/board.asm index bef499306c..06e6297901 100644 --- a/programs/system/board/trunk/board.asm +++ b/programs/system/board/trunk/board.asm @@ -428,7 +428,7 @@ else title db 'General debug & message board',0 end if -default_filename db '/sys/boardlog.txt',0 +default_filename db '/tmp0/1/boardlog.txt',0 krnl_msg db 'K : ' duk db 'KernUser' my_name db 'board',0 diff --git a/programs/system/eskin/trunk/build.bat b/programs/system/eskin/trunk/build.bat new file mode 100644 index 0000000000..bd8211b9cc --- /dev/null +++ b/programs/system/eskin/trunk/build.bat @@ -0,0 +1,3 @@ +@fasm eskin.asm eskin +@kpack eskin +@pause \ No newline at end of file diff --git a/programs/system/eskin/trunk/eskin.asm b/programs/system/eskin/trunk/eskin.asm index 2f85ca1e1f..884f68b944 100644 --- a/programs/system/eskin/trunk/eskin.asm +++ b/programs/system/eskin/trunk/eskin.asm @@ -1 +1 @@ - use32 org 0x0 db 'MENUET01' ; 8 byte id dd 38 ; required os dd STARTAPP ; program start dd I_END ; program image size dd 0x1000000 ; required amount of memory dd 0x1000000 ; stack heap dd app_path dd 0x0 include '../../../proc32.inc' include '../../../macros.inc' include '../../../dll.inc' PATH_MAX_CHARS equ 255 STARTAPP: ; Initialize memory mcall 68, 11 or eax,eax jz close_app ;Import libraries stdcall dll.Load,importTable test eax, eax jnz close_app invoke ini_get_int, aIni, aMain, aButton, 0 mov ecx, eax mcall 48, 1 invoke ini_get_int, aIni, aMain, aBg, 0 cmp eax, 1 jnz set_bg set_program: invoke ini_get_str, aIni, aMain, aProgram, sz_buffer, PATH_MAX_CHARS, 0 invoke ini_get_str, aIni, aMain, aParam, sz_param, PATH_MAX_CHARS, 0 stdcall RunProgram, sz_buffer, sz_param jmp set_skin set_bg: invoke ini_get_str, aIni, aMain, aWallpaper, sz_param, PATH_MAX_CHARS, 0 mov byte [sz_buffer + 0],'\' mov byte [sz_buffer + 1], 'S' mov byte [sz_buffer + 2], '_' mov byte [sz_buffer + 3], '_' mov edi, 0 @@: mov ah, byte [sz_param + edi] mov byte [sz_buffer + edi + 4], ah inc edi cmp byte [sz_param + edi], 0 jne @b mov byte [sz_buffer + edi + 4], 0 mcall 70, is_kiv set_skin: invoke ini_get_str, aIni, aMain, aSkin, sz_param, PATH_MAX_CHARS, 0 mcall 48, 8, sz_param close_app: mcall -1 proc RunProgram stdcall, app_path:dword, app_param:dword pusha mov dword [InfoStructure], 7 ; run program mov dword [InfoStructure+4], 0 ; flags mov eax, [app_param] mov dword [InfoStructure+8], eax ; pointer to the parametrs mov dword [InfoStructure+12], 0 ; reserved mov dword [InfoStructure+16], 0 ; reserved mov dword [InfoStructure+20], 0 ; reserved mov eax, [app_path] mov dword [InfoStructure+21], eax ; pointer to the file name mcall 70, InfoStructure popa ret endp align 16 importTable: library \ libini, 'libini.obj' import libini, \ ini_get_str ,'ini_get_str', \ ini_set_str ,'ini_set_str', \ ini_get_int ,'ini_get_int', \ ini_set_int ,'ini_set_int' InfoStructure: dd 0x0 ; subfunction number dd 0x0 ; position in the file in bytes dd 0x0 ; upper part of the position address dd 0x0 ; number of bytes to read dd 0x0 ; pointer to the buffer to write data db 0 dd 0 ; pointer to the filename aIni db '/rd/1/settings/eskin.ini',0 aMain db 'main',0 aBg db 'bg',0 aButton db '3d',0 aSkin db 'skin',0 aWallpaper db 'wallpaper',0 aProgram db 'program',0 aParam db 'param',0 is_kiv: dd 7, 0, sz_buffer, 0, 0 db "/rd/1/media/kiv", 0 sz_buffer: rb PATH_MAX_CHARS sz_param: rb PATH_MAX_CHARS I_END: ; End of application code and data marker app_path rb PATH_MAX_CHARS \ No newline at end of file + use32 org 0x0 db 'MENUET01' ; 8 byte id dd 38 ; required os dd STARTAPP ; program start dd I_END ; program image size dd 0x1000000 ; required amount of memory dd 0x1000000 ; stack heap dd 0x0 dd 0x0 include '../../../proc32.inc' include '../../../macros.inc' include '../../../dll.inc' PATH_MAX_CHARS equ 255 STARTAPP: ; Initialize memory mcall 68, 11 or eax,eax jz close_app ;Import libraries stdcall dll.Load,importTable test eax, eax jnz close_app invoke ini_get_int, aIni, aMain, aButton, 0 mov ecx, eax mcall 48, 1 invoke ini_get_int, aIni, aMain, aBg, 0 cmp eax, 1 jnz set_bg set_program: invoke ini_get_str, aIni, aMain, aProgram, sz_buffer, PATH_MAX_CHARS, 0 invoke ini_get_str, aIni, aMain, aParam, sz_param, PATH_MAX_CHARS, 0 stdcall RunProgram, sz_buffer, sz_param jmp set_skin set_bg: invoke ini_get_str, aIni, aMain, aWallpaper, sz_param, PATH_MAX_CHARS, 0 mov dword [sz_buffer], "\__S" xor edi, edi @@: mov ah, byte [sz_param + edi] mov byte [sz_buffer + edi + 4], ah inc edi cmp byte [sz_param + edi], 0 jne @b mov byte [sz_buffer + edi + 4], 0 stdcall RunProgram, sz_buffer, aKiv set_skin: invoke ini_get_str, aIni, aMain, aSkin, sz_param, PATH_MAX_CHARS, 0 mcall 48, 8, sz_param close_app: mcall -1 proc RunProgram stdcall, app_path:dword, app_param:dword push eax m2m dword [InfoStructure+8], [app_param] ; pointer to the parametrs m2m dword [InfoStructure+21], [app_path] ; pointer to the file name mcall 70, InfoStructure pop eax ret endp align 16 importTable: library \ libini, 'libini.obj' import libini, \ ini_get_str ,'ini_get_str', \ ini_get_int ,'ini_get_int' InfoStructure: dd 7 ; subfunction number dd 0 ; position in the file in bytes dd ? ; upper part of the position address dd 0 ; number of bytes to read dd 0 ; pointer to the buffer to write data db 0 dd ? ; pointer to the filename aIni db '/sys/settings/eskin.ini',0 aKiv db '/sys/media/kiv',0 aMain db 'main',0 aBg db 'bg',0 aButton db '3d',0 aSkin db 'skin',0 aWallpaper db 'wallpaper',0 aProgram db 'program',0 aParam db 'param',0 sz_buffer: rb PATH_MAX_CHARS sz_param: rb PATH_MAX_CHARS I_END: ; End of application code and data marker \ No newline at end of file