New versions of End and RDsave. See forum for detales.

git-svn-id: svn://kolibrios.org@4213 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
heavyiron 2013-11-11 22:49:12 +00:00
parent daa2b8868e
commit fa45c7e5db
7 changed files with 875 additions and 569 deletions

View File

@ -0,0 +1,5 @@
[path]
path=/usbhdd0/1/kolibri.img
[settings]
autoclose=0
autosave=0

View File

@ -1,42 +1,98 @@
if lang eq ru
label2:
db '‚몫îç¨âì Ÿ¤à®',0
db '‚몫îç¨âì Ÿ¤à®',0
label3:
db '<27>¥à¥§ ¯ã᪠Žâ¬¥­ ',0
db '<27>¥à¥§ ¯ã᪠Žâ¬¥­ ',0
label4:
db '‘®åà ­¨âì ­ áâனª¨ (Ctrl-S)',0
else if lang eq ge
label2:
db ' Beenden Kernel',0
db ' Beenden Kernel',0
label3:
db ' Neustart Abbrechen',0
db ' Neustart Abbrechen',0
label4:
db 'Save your settings (Ctrl-S)',0
else if lang eq it
label2:
db ' Spegni Kernel',0
db ' Spegni Kernel',0
label3:
db ' Riavvio Annulla',0
db ' Riavvio Annulla',0
label4:
db 'Salva impostazioni (Ctrl-S)',0
else
label2:
db 'Power off Kernel',0
db ' Power off Kernel',0
label3:
db ' Restart Cancel',0
db ' Restart Cancel',0
label4:
db 'Save your settings (Ctrl-S)',0
end if
label5:
db '(End) (Home)',0
db '(End) (Home)',0
label6:
db '(Enter) (Esc)',0
db '(Enter) (Esc)',0
rdsave:
dd 7,0,0,0,0
db '/sys/rdsave',0
dd 7,0,hide,0,0
db '/sys/rdsave',0
;---------------------------------------------------------------------
;Lib_DATA
;‚ᥣ¤  ᮡ«î¤ âì ¯®á«¥¤®¢ â¥«ì­®áâì ¢ ¨¬¥­¨.
system_dir_Boxlib db '/sys/lib/box_lib.obj',0
system_dir_libini db '/sys/lib/libini.obj',0
;---------------------------------------------------------------------
head_f_i:
head_f_l db 'System error',0
err_message_found_lib1 db 'box_lib.obj - Not found!',0
err_message_found_lib2 db 'libini.obj - Not found!',0
err_message_import1 db 'box_lib.obj - Wrong import!',0
err_message_import2 db 'libini.obj - Wrong import!',0
;---------------------------------------------------------------------
l_libs_start:
library01 l_libs system_dir_Boxlib+9, cur_dir_path, library_path, system_dir_Boxlib, \
err_message_found_lib1, head_f_l, Box_lib_import, err_message_import1, head_f_i
library02 l_libs system_dir_libini+9, cur_dir_path, library_path, system_dir_libini, \
err_message_found_lib2, head_f_l, libini_import, err_message_import2, head_f_i
end_l_libs:
;---------------------------------------------------------------------
align 4
Box_lib_import:
init_checkbox2 dd aInit_checkbox2
check_box_draw2 dd aCheck_box_draw2
check_box_mouse2 dd aCheck_box_mouse2
;version_ch2 dd aVersion_ch2
dd 0
dd 0
aInit_checkbox2 db 'init_checkbox2',0
aCheck_box_draw2 db 'check_box_draw2',0
aCheck_box_mouse2 db 'check_box_mouse2',0
;aVersion_ch2 db 'version_ch2',0
;---------------------------------------------------------------------
align 4
libini_import:
init_lib dd a_init
ini_get_int dd aini_get_int
ini_set_int dd aini_set_int
dd 0
dd 0
a_init db 'lib_init',0
aini_get_int db 'ini_get_int',0
aini_set_int db 'ini_set_int',0
;---------------------------------------------------------------------
check1 check_box2 20 shl 16 +8,93 shl 16 +8,6,0xffffff,0,0,label4
hide db 'h',0
asettings db 'settings',0
aautosave db 'autosave',0
ini_file db '/sys/settings/rdsave.ini',0

View File

@ -2,71 +2,83 @@
; END
; KolibriOS Team 2005-2013
;
include "lang.inc"
include "..\..\..\macros.inc"
; <diamond> note that 'mov al,xx' is shorter than 'mov eax,xx'
; and if we know that high 24 bits of eax are zero, we can use 1st form
; the same about ebx,ecx,edx
meos_app_start
code
draw_window:
mov al,12
mcall ,1
use32 ; âêëþ÷èòü 32-áèòíûé ðåæèì àññåìáëåðà
org 0x0 ; àäðåñàöèÿ ñ íóëÿ
mov al,14
mcall ;eax=14 - get screen max x & max y
movzx ecx,ax
shr eax,17
shl eax,16
lea ebx,[eax-110 shl 16+222]
shr ecx,1
shl ecx,16
lea ecx,[ecx-65 shl 16+137]
db 'MENUET01' ; 8-áàéòíûé èäåíòèôèêàòîð MenuetOS
dd 0x01 ; âåðñèÿ çàãîëîâêà (âñåãäà 1)
dd START ; àäðåñ ïåðâîé êîìàíäû
dd IM_END ; ðàçìåð ïðîãðàììû
dd I_END ; êîëè÷åñòâî ïàìÿòè
dd stacktop ; àäðåñ âåðøèíû ñòåêà
dd 0x0 ; àäðåñ áóôåðà äëÿ ïàðàìåòðîâ
dd cur_dir_path
xor eax,eax
mcall , , ,0x019098b0,0x01000000 ;define and draw window
include 'lang.inc'
include '../../../macros.inc'
include '../../../proc32.inc'
include '../../../dll.inc'
include '../../../develop/libraries/box_lib/load_lib.mac'
include '../../../develop/libraries/box_lib/trunk/box_lib.mac'
mov al,13
mcall ,<0,223> ,<0,275>
mcall ,<1,221>,<1,136>,0xffffff
mcall ,<2,220>,<2,135>,0xe4dfe1
mcall ,<16,189>,<97,23>,0x9098b0
@use_library
mov al,8
mcall ,<16,90> ,<20,27>,4,0x990022 ;eax=8 - draw buttons
mcall ,<113,90>, ,2,0xaa7700
mcall , ,<54,27>,1,0x777777
mcall ,<16,90> , ,3,0x007700
mcall ,<17,186>,<98,20>,5,0xe4dfe1
align 4
START:
mov al,4
mcall ,<28,105>,0x80000000,label4 ;eax=4 - write text
mcall ,<35,24> ,0x80ffffff,label2
mcall ,<34,58> , ,label3
mcall ,<47,37> , ,label5
mcall ,<43,71> , ,label6
load_libraries l_libs_start,end_l_libs
inc eax
test eax,eax
jz close
mov al,12
mcall ,2
push dword check1
call [init_checkbox2]
stdcall dll.Init,[init_lib]
invoke ini_get_int,ini_file,asettings,aautosave,0
mov [autosave],eax
cmp eax,1
jne @f
bts dword [check1.flags],1
@@:
mcall 40,0x00000027
redraw:
call draw_window
still:
mov al,10
mcall ;wait here for event
dec eax
jz draw_window
jz redraw
dec eax
jnz button
jz key
dec eax
jz button
push dword check1
call [check_box_mouse2]
bt dword [check1.flags],1
jnc @f
mov [autosave],1
jmp still
@@:
mov [autosave],0
jmp still
key:
mov al,2
mcall ;eax=2 - get key code
mov al,ah
cmp al,13
jz restart
cmp al,19
jz run_rdsave
jz checkbox
cmp al,27
jz close_1
jz close
cmp al,180
jz restart_kernel
cmp al,181
@ -74,45 +86,127 @@ still:
jmp still
button:
mov al,17
mcall ;eax=17 - get pressed button id
mcall 17 ;eax=17 - get pressed button id
xchg al,ah
dec eax
jz close_1
jz close
dec eax
jz restart_kernel
dec eax
jz restart
dec eax
jnz run_rdsave
; dec eax ; we have only one button left, this is close button
; jnz still
jnz checkbox
power_off:
push 2
jmp mcall_and_close
restart:
push 3
jmp mcall_and_close
restart_kernel:
push 4
mcall_and_close:
invoke ini_set_int,ini_file,asettings,aautosave,[autosave]
cmp [autosave],1
jne no_save
mcall 70,rdsave
test eax,eax
js no_save
mov ecx,eax
mcall 18,21
mov ecx,eax
@@:
push ecx
mcall 23,50
dec eax
jnz no_red
call draw_window
no_red:
pop ecx
mcall 9,proc_info
cmp [proc_info+50],9
je no_save
jmp @b
no_save:
pop ecx
mov al,18
mcall ,9
mcall 18,9
close_1:
or eax,-1
mcall
close:
mcall -1
run_rdsave:
mov al,70
mcall ,rdsave
jmp still
checkbox:
btc dword [check1.flags],1
jc .1
mov [autosave],1
jmp .draw
.1:
mov [autosave],0
.draw:
push dword check1
call [check_box_draw2]
jmp still
draw_window:
mov al,12
mcall ,1
mcall 14 ;eax=14 - get screen max x & max y
movzx ecx,ax
shr eax,17
shl eax,16
lea ebx,[eax-110 shl 16+222]
shr ecx,1
shl ecx,16
lea ecx,[ecx-70 shl 16+117]
xor eax,eax
mcall , , ,0x019098b0,0x01000000 ;define and draw window
mov al,13
mcall ,<0,223> ,<0,118>
mcall ,<1,221>,<1,116>,0xffffff
mcall ,<2,220>,<2,115>,0xe4dfe1
mov al,8
mcall ,<16,90> ,<20,27>,4,0x990022 ;eax=8 - draw buttons
mcall ,<113,90>, ,2,0xaa7700
mcall , ,<54,27>,1,0x777777
mcall ,<16,90> , ,3,0x007700
push dword check1
call [check_box_draw2]
mcall 4,<27,24> ,0x90ffffff,label2 ;eax=4 - write text
mcall ,<23,58> , ,label3
mcall ,<47,37> ,0x90ffffff,label5
mcall ,<44,71> , ,label6
mov al,12
mcall ,2
ret
data
include 'data.inc'
udata
;---------------------------------------------------------------------
IM_END:
;---------------------------------------------------------------------
align 4
meos_app_end
proc_info rb 1024
autosave rd 1
;---------------------------------------------------------------------
cur_dir_path:
rb 4096
;---------------------------------------------------------------------
library_path:
rb 4096
;---------------------------------------------------------------------
align 32
rb 4096
stacktop:
I_END: ; ìåòêà êîíöà ïðîãðàììû

View File

@ -0,0 +1,6 @@
@erase lang.inc
@echo lang fix it >lang.inc
@fasm rdsave.asm rdsave
@kpack rdsave
@erase lang.inc
@pause

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,5 @@
[path]
path=/usbhdd0/1/kolibri.img
[settings]
autoclose=0
autosave=0

View File

@ -0,0 +1,129 @@
; by ManHunter / PCL
; http://www.manhunter.ru
;-----------------------------------------------------
; ”ã­ªæ¨ï ¯®«ã祭¨ï ¤«¨­ë áâப¨ (Fast)
;-----------------------------------------------------
; lpStr - 㪠§ â¥«ì ­  áâபã ASCIIZ
; <EFBFBD>  ¢ë室¥: EAX - ¤«¨­  áâப¨ ¡¥§ ãç¥â  § ¢¥àè î饣®
; ­ã«¥¢®£® ¡ ©â 
;-----------------------------------------------------
;proc _lstrlen lpStr:DWORD
; mov eax, [lpStr]
; sub eax, 4
;@@:
; add eax, 4
; cmp byte [eax], 0
; je .szlen_lb1
; cmp byte [eax+1], 0
; je .szlen_lb2
; cmp byte [eax+2], 0
; je .szlen_lb3
; cmp byte [eax+3], 0
; jne @b
; sub eax, [lpStr]
; add eax, 3
; ret
;.szlen_lb3:
; sub eax, [lpStr]
; add eax, 2
; ret
;.szlen_lb2:
; sub eax, [lpStr]
; add eax, 1
; ret
;.szlen_lb1:
; sub eax, [lpStr]
; ret
;endp
;-----------------------------------------------------
; ”ã­ªæ¨ï ¯®«ã祭¨ï ¤«¨­ë áâப¨
;-----------------------------------------------------
; lpStr - 㪠§ â¥«ì ­  áâபã ASCIIZ
; <EFBFBD>  ¢ë室¥: EAX - ¤«¨­  áâப¨ ¡¥§ ãç¥â  § ¢¥àè î饣®
; ­ã«¥¢®£® ¡ ©â 
;-----------------------------------------------------
proc _lstrlen lpStr:DWORD
push edi ecx
cld
mov edi,[lpStr]
xor ecx,ecx
dec ecx
xor eax,eax
repne scasb
not ecx
dec ecx
mov eax,ecx
pop ecx edi
ret
endp
;-----------------------------------------------------
; ”ã­ªæ¨ï ¡ëáâண® á«¨ï­¨ï ¤¢ãå áâப
; ¨á¯®«ì§ãîâáï ä㭪樨 _lstrlen, _lstrcpy
;-----------------------------------------------------
; lpDst - 㪠§ â¥«ì ­  ¨á室­ãî áâபã ASCIIZ
; lpSrc - 㪠§ â¥«ì ­  ¤®¡ ¢«ï¥¬ãî áâபã ASCIIZ
;-----------------------------------------------------
proc _lstrcat lpDst:DWORD, lpSrc:DWORD
pusha
stdcall _lstrlen,[lpDst]
add eax,[lpDst]
stdcall _lstrcpy,eax,[lpSrc]
popa
ret
endp
;-----------------------------------------------------
; ”ã­ªæ¨ï ¡ëáâண® ª®¯¨à®¢ ­¨ï áâப¨
; ¨á¯®«ì§ãîâáï ä㭪樨 _lstrlen, _memcopy
;-----------------------------------------------------
; lpDst - 㪠§ â¥«ì ­  ¯à¨¥¬­¨ª
; lpSrc - 㪠§ â¥«ì ­  áâபã ASCIIZ
;-----------------------------------------------------
proc _lstrcpy lpDst:DWORD, lpSrc:DWORD
pusha
stdcall _lstrlen,[lpSrc]
inc eax
stdcall _memcopy,[lpDst],[lpSrc],eax
popa
ret
endp
;-----------------------------------------------------
; ”ã­ªæ¨ï ¡ëáâண® ª®¯¨à®¢ ­¨ï ãç á⪠ ¯ ¬ïâ¨
;-----------------------------------------------------
; lpDst - 㪠§ â¥«ì ­  ¯à¨¥¬­¨ª
; lpSrc - 㪠§ â¥«ì ­  ¨áâ®ç­¨ª
; dSize - à §¬¥à ª®¯¨à㥬®£® ¡«®ª 
;-----------------------------------------------------
proc _memcopy lpDst:DWORD, lpSrc:DWORD, dSize:DWORD
pusha
; “áâ ­®¢¨âì 㪠§ â¥«¨ ­  ¨áâ®ç­¨ª ¨ ¯à¨¥¬­¨ª
cld
mov edi,[lpDst]
mov esi,[lpSrc]
mov ecx,[dSize]
push ecx
; <EFBFBD> §¤¥«¨âì ­  4 ¨ ¯®«ãç¨âì ¤«¨­ã ¢ DWORD
shr ecx,2
; ‘ª®¯¨à®¢ âì ®á­®¢­ãî ç áâì áâப¨ DWORD' ¬¨
rep movsd
pop ecx
; <EFBFBD>®«ãç¨âì ®áâ â®ª ®â ¤¥«¥­¨ï ­  4
and ecx,3
; ‘ª®¯¨à®¢ âì ®áâ â®ª áâப¨ ¡ ©â ¬¨
rep movsb
popa
ret
endp