Subversion Repositories Kolibri OS

Rev

Rev 9531 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
341 heavyiron 1
;   RDsave для Kolibri (0.6.5.0 и старше)
4213 heavyiron 2
;   Save RAM-disk to hard or floppy drive
1606 mario79 3
;---------------------------------------------------------------------
205 heavyiron 4
;   Mario79 2005
341 heavyiron 5
;   Heavyiron 12.02.2007
1070 Lrz 6
;        11.05.2009 - для работы нужна системная библиотека box_lib.obj
4213 heavyiron 7
;   Mario79   08.09.2010 - select path with OpenDialog,keys 1,2,3,4 for select options
8
;   Heavyiron 01.12.2013 - new logic
341 heavyiron 9
;---------------------------------------------------------------------
205 heavyiron 10
appname equ 'RDsave '
9531 leency 11
version equ '1.44'
4810 eAndrew 12
debug	equ no
3634 fedesco 13
 
4810 eAndrew 14
use32	     ; включить 32-битный режим ассемблера
4213 heavyiron 15
org 0x0      ; адресация с нуля
205 heavyiron 16
 
4810 eAndrew 17
db 'MENUET01'	 ; 8-байтный идентификатор MenuetOS
18
dd 0x01 	 ; версия заголовка (всегда 1)
19
dd START	 ; адрес первой команды
20
dd IM_END	 ; размер программы
21
dd I_END	 ; количество памяти
22
dd stacktop	 ; адрес вершины стека
23
dd PARAMS	 ; адрес буфера для параметров
4213 heavyiron 24
dd cur_dir_path
205 heavyiron 25
 
4213 heavyiron 26
 
27
include 'lang.inc'
28
include '../../../macros.inc'
29
if debug eq yes
30
include '../../../debug.inc'
31
end if
32
include '../../../proc32.inc'
33
include '../../../dll.inc'
9568 IgorA 34
include '../../../KOSfuncs.inc'
35
include '../../../load_lib.mac'
1373 IgorA 36
include '../../../develop/libraries/box_lib/trunk/box_lib.mac'
4213 heavyiron 37
include 'str.inc'
1070 Lrz 38
 
4810 eAndrew 39
	@use_library
341 heavyiron 40
;---------------------------------------------------------------------
41
;---  НАЧАЛО ПРОГРАММЫ  ----------------------------------------------
42
;---------------------------------------------------------------------
1070 Lrz 43
align 4
44
START:
4213 heavyiron 45
;---------------------------------------------------------------------
4810 eAndrew 46
	mcall  68,11
1606 mario79 47
 
48
load_libraries l_libs_start,end_l_libs
4810 eAndrew 49
	inc	eax
50
	test	eax,eax
51
	jz	close
1606 mario79 52
 
4810 eAndrew 53
	stdcall dll.Init,[init_lib]
205 heavyiron 54
 
9531 leency 55
	invoke	ini_get_int,ini_file,ini_section,aautoclose,0
4810 eAndrew 56
	mov	[autoclose],eax
9531 leency 57
	invoke	ini_get_str,ini_file,ini_section,apath,fname_buf,4096,path
4810 eAndrew 58
	stdcall _lstrcpy,ini_path,fname_buf
59
	stdcall _lstrcpy,filename_area,start_temp_file_name
4213 heavyiron 60
 
4810 eAndrew 61
	mov   eax,PARAMS
62
	cmp   byte[eax], 0
63
	je    no_params
64
	cmp   byte[eax], 'h'
65
	je    @f
66
	cmp   byte[eax], 'H'
67
	jne   .no_h
1606 mario79 68
@@:
4810 eAndrew 69
	mov   [hidden],1
70
	jmp   no_params
4213 heavyiron 71
.no_h:
4810 eAndrew 72
	mov   [param],1
73
	stdcall _lstrcpy,fname_buf,eax
74
	mov   ah,2
75
	jmp   noclose
1228 Lrz 76
 
4270 heavyiron 77
;---------------------------------------------------------------------
4213 heavyiron 78
no_params:
4810 eAndrew 79
	stdcall _lstrcpy,check_dir,ini_path
80
	call	check_path
81
	test	eax,eax
82
	jz	path_ok
83
	cmp	eax,6
84
	je	path_ok
4213 heavyiron 85
;---------------------------------------------------------------------
86
if debug eq yes
87
dps 'read_folder_error'
88
newline
89
end if
90
;---------------------------------------------------------------------
4290 heavyiron 91
default_path:
4810 eAndrew 92
	stdcall _lstrcpy,fname_buf,communication_area_default_path
93
	mov	[hidden],0
4213 heavyiron 94
 
95
;OpenDialog     initialisation
4810 eAndrew 96
	push	dword OpenDialog_data
97
	call	[OpenDialog_Init]
4213 heavyiron 98
 
1606 mario79 99
; prepare for PathShow
4810 eAndrew 100
	push	dword PathShow_data_1
101
	call	[PathShow_prepare]
4290 heavyiron 102
 
4810 eAndrew 103
	mcall	40,0x00000027
4290 heavyiron 104
 
4810 eAndrew 105
	call	draw_window
106
	mov	ah,3
107
	jmp	noclose
4213 heavyiron 108
;---------------------------------------------------------------------
109
path_ok:
110
;OpenDialog     initialisation
4810 eAndrew 111
	push	dword OpenDialog_data
112
	call	[OpenDialog_Init]
1606 mario79 113
 
4213 heavyiron 114
; prepare for PathShow
4810 eAndrew 115
	push	dword PathShow_data_1
116
	call	[PathShow_prepare]
205 heavyiron 117
 
4810 eAndrew 118
	mcall	40,0x00000027
4213 heavyiron 119
 
4810 eAndrew 120
	cmp	[hidden],1
121
	jne	red
122
	mov	ah,2
123
	jmp	noclose
4213 heavyiron 124
red:
4810 eAndrew 125
	call	draw_window
341 heavyiron 126
;---------------------------------------------------------------------
127
still:
4810 eAndrew 128
	mcall 10
205 heavyiron 129
 
4810 eAndrew 130
	dec	eax	 ; перерисовать окно?
131
	jz	red	 ; если да - на метку red
132
	dec	eax
133
	jz	key
134
	dec	eax
135
	jz	button
136
	jmp	still
1606 mario79 137
;---------------------------------------------------------------------
341 heavyiron 138
button:
4810 eAndrew 139
	mcall	17	; получить идентификатор нажатой кнопки
140
	cmp	ah,1		 ; кнопка с id=1("закрыть")?
141
	jne	noclose
1070 Lrz 142
close:
4810 eAndrew 143
	mcall	-1	    ; функция -1: завершить программу
144
 
4213 heavyiron 145
;---------------------------------------------------------------------
146
key:
4810 eAndrew 147
	mcall	2
148
	cmp	ah,0x1b
149
	je	close
150
	cmp	ah,0x0D
151
	jne	@f
152
	mov	ah,2
153
	jmp	noclose
4213 heavyiron 154
@@:
4810 eAndrew 155
	cmp	ah,9h
156
	jne	still
4213 heavyiron 157
;---------------------------------------------------------------------
341 heavyiron 158
noclose:
4810 eAndrew 159
	mov	ecx,fname_buf
160
	push  16
161
	mov   ebx,1
162
	cmp   byte[ecx+1],'f'
163
	je    @f
164
	cmp   byte[ecx+1],'F'
165
	jne   not_fdd
4213 heavyiron 166
@@:
4810 eAndrew 167
	cmp   byte[ecx+4],'1'
168
	jne   @f
169
	cmp   ah,2
170
	je    doit
4213 heavyiron 171
@@:
4810 eAndrew 172
	inc   ebx
173
	cmp   ah,2
174
	je    doit
4213 heavyiron 175
not_fdd:
4810 eAndrew 176
	push  18
177
	mov   ebx,6	; 18.6 = save to specified folder
178
	cmp   ah,2
179
	je    doit
1606 mario79 180
 
181
; invoke OpenDialog
4810 eAndrew 182
	push	dword OpenDialog_data
183
	call	[OpenDialog_Start]
184
	cmp	[OpenDialog_data.status],1
185
	jne	still
1606 mario79 186
 
187
; prepare for PathShow
4810 eAndrew 188
	push	dword PathShow_data_1
189
	call	[PathShow_prepare]
190
	call	draw_window
191
	mov	ah,2
192
	jmp	noclose
1606 mario79 193