forked from KolibriOS/kolibrios
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
This commit is contained in:
parent
e1ae8286e5
commit
def6ce4577
@ -35,6 +35,12 @@ include '../../../macros.inc'
|
|||||||
include '../../../gui_patterns.inc'
|
include '../../../gui_patterns.inc'
|
||||||
include '../../../KOSfuncs.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:
|
START:
|
||||||
red:
|
red:
|
||||||
call draw_window
|
call draw_window
|
||||||
@ -53,9 +59,10 @@ button:
|
|||||||
|
|
||||||
key:
|
key:
|
||||||
mcall 2 ; get ASCII key code
|
mcall 2 ; get ASCII key code
|
||||||
|
and eax, 0xffff ; supress scancodes
|
||||||
shr eax, 8
|
shr eax, 8
|
||||||
mov edi, asci ; convert ASCII into button id
|
mov edi, asci ; convert ASCII into button id
|
||||||
mov ecx, 18
|
mov ecx, hotkeys_count
|
||||||
cld
|
cld
|
||||||
repne scasb
|
repne scasb
|
||||||
jne still
|
jne still
|
||||||
@ -261,6 +268,7 @@ no_sqrt:
|
|||||||
call calculate
|
call calculate
|
||||||
call new_entry
|
call new_entry
|
||||||
mov [calc], '+'
|
mov [calc], '+'
|
||||||
|
call print_display
|
||||||
jmp still
|
jmp still
|
||||||
|
|
||||||
no_add:
|
no_add:
|
||||||
@ -269,6 +277,7 @@ no_add:
|
|||||||
call calculate
|
call calculate
|
||||||
call new_entry
|
call new_entry
|
||||||
mov [calc], '-'
|
mov [calc], '-'
|
||||||
|
call print_display
|
||||||
jmp still
|
jmp still
|
||||||
|
|
||||||
no_sub:
|
no_sub:
|
||||||
@ -277,6 +286,7 @@ no_sub:
|
|||||||
call calculate
|
call calculate
|
||||||
call new_entry
|
call new_entry
|
||||||
mov [calc], '/'
|
mov [calc], '/'
|
||||||
|
call print_display
|
||||||
jmp still
|
jmp still
|
||||||
|
|
||||||
no_div:
|
no_div:
|
||||||
@ -285,6 +295,7 @@ no_div:
|
|||||||
call calculate
|
call calculate
|
||||||
mov [calc], '*'
|
mov [calc], '*'
|
||||||
call new_entry
|
call new_entry
|
||||||
|
call print_display
|
||||||
jmp still
|
jmp still
|
||||||
|
|
||||||
no_mul:
|
no_mul:
|
||||||
@ -704,6 +715,11 @@ next_button:
|
|||||||
cmp [edx], byte 'x'
|
cmp [edx], byte 'x'
|
||||||
jne next_line
|
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>, <DISPLAY_Y+1, DISPLAY_Y+1>, 0xE0E0E0 ; internal shadow
|
||||||
|
mcall , < DISPLAY_X+1, DISPLAY_X+1>, <DISPLAY_Y+2, DISPLAY_Y+DISPLAY_H-1>, ; internal shadow
|
||||||
|
|
||||||
call print_display
|
call print_display
|
||||||
|
|
||||||
mcall 12, 2
|
mcall 12, 2
|
||||||
@ -711,10 +727,6 @@ next_button:
|
|||||||
|
|
||||||
print_display:
|
print_display:
|
||||||
pusha
|
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>, <DISPLAY_Y+1, DISPLAY_Y+1>, 0xE0E0E0 ; internal shadow
|
|
||||||
mcall , < DISPLAY_X+1, DISPLAY_X+1>, <DISPLAY_Y+2, DISPLAY_Y+DISPLAY_H-1>, ; internal shadow
|
|
||||||
mcall 13, < DISPLAY_X+2, DISPLAY_W-2>, <DISPLAY_Y+2, DISPLAY_H-2>, 0xFFFfff ; background
|
mcall 13, < DISPLAY_X+2, DISPLAY_W-2>, <DISPLAY_Y+2, DISPLAY_H-2>, 0xFFFfff ; background
|
||||||
mcall 8, <236,53>, <DISPLAY_Y,DISPLAY_H>, 3, [sc.work] ; 'dec-bin-hex'
|
mcall 8, <236,53>, <DISPLAY_Y,DISPLAY_H>, 3, [sc.work] ; 'dec-bin-hex'
|
||||||
|
|
||||||
@ -840,9 +852,6 @@ text:
|
|||||||
db 3,'+/-', 1,'0', 1,'.', 1,'*', 3,'Sqr', 2,'Pi', 1,'=', 0
|
db 3,'+/-', 1,'0', 1,'.', 1,'*', 3,'Sqr', 2,'Pi', 1,'=', 0
|
||||||
db 'x'
|
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:
|
I_END:
|
||||||
|
|
||||||
sc system_colors
|
sc system_colors
|
||||||
|
@ -428,7 +428,7 @@ else
|
|||||||
title db 'General debug & message board',0
|
title db 'General debug & message board',0
|
||||||
end if
|
end if
|
||||||
|
|
||||||
default_filename db '/sys/boardlog.txt',0
|
default_filename db '/tmp0/1/boardlog.txt',0
|
||||||
krnl_msg db 'K : '
|
krnl_msg db 'K : '
|
||||||
duk db 'KernUser'
|
duk db 'KernUser'
|
||||||
my_name db 'board',0
|
my_name db 'board',0
|
||||||
|
3
programs/system/eskin/trunk/build.bat
Normal file
3
programs/system/eskin/trunk/build.bat
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
@fasm eskin.asm eskin
|
||||||
|
@kpack eskin
|
||||||
|
@pause
|
@ -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
include '../../../proc32.inc'
mov byte [sz_buffer + 1], 'S'
mov byte [sz_buffer + 2], '_'
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
include '../../../proc32.inc'
include '../../../dll.inc'
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]
include '../../../macros.inc'
include '../../../macros.inc'
PATH_MAX_CHARS equ 255
include '../../../dll.inc'
include '../../../dll.inc'
app_path
include '../../../dll.inc'
dd 0x0
include '../../../dll.inc'
mcall 70, InfoStructure
popa
include '../../../dll.inc'
include '../../../dll.inc'
endp
align 16
importTable:
library \
libini, 'libini.obj'
import libini, \
ini_get_str ,'ini_get_str', \
include '../../../proc32.inc'
include '../../../macros.inc'
include '../../../dll.inc'
PATH_MAX_CHARS equ 255
app_path
dd 0x0
include '../../../proc32.inc'
include '../../../macros.inc'
include '../../../dll.inc'
aButton db '3d',0
aSkin db 'skin',0
PATH_MAX_CHARS equ 255
app_path
PATH_MAX_CHARS equ 255
dd 0x0
PATH_MAX_CHARS equ 255
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
|
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
STARTAPP:
include '../../../proc32.inc'
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
STARTAPP:
include '../../../dll.inc'
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
STARTAPP:
STARTAPP:
PATH_MAX_CHARS equ 255
; Initialize memory
; Initialize memory
app_path
; Initialize memory
dd 0x0
include '../../../dll.inc'
include '../../../dll.inc'
endp
align 16
importTable:
library \
libini, 'libini.obj'
import libini, \
ini_get_str ,'ini_get_str', \
ini_get_int ,'ini_get_int'
; Initialize memory
include '../../../proc32.inc'
; Initialize memory
include '../../../macros.inc'
; Initialize memory
include '../../../dll.inc'
; Initialize memory
; Initialize memory
; Initialize memory
PATH_MAX_CHARS equ 255
dd ? ; pointer to the filename
include '../../../macros.inc'
include '../../../macros.inc'
mcall 68, 11
app_path
mcall 68, 11
dd 0x0
mcall 68, 11
mcall 68, 11
include '../../../proc32.inc'
mcall 68, 11
include '../../../macros.inc'
mcall 68, 11
include '../../../dll.inc'
mcall 68, 11
mcall 68, 11
app_path
dd 0x0
PATH_MAX_CHARS equ 255
sz_buffer:
rb PATH_MAX_CHARS
sz_param:
rb PATH_MAX_CHARS
I_END: ; End of application code and data marker
|
Loading…
Reference in New Issue
Block a user