Subversion Repositories Kolibri OS

Rev

Rev 485 | Go to most recent revision | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 485 Rev 539
1
; @RCHER macros and messages
1
; @RCHER macros and messages
2
; Written in pure assembler by Ivushkin Andrey aka Willow
2
; Written in pure assembler by Ivushkin Andrey aka Willow
3
 
3
 
4
macro stop
4
macro stop
5
{
5
{
6
  if SYS eq win & NO_STOPS eq 0
6
  if SYS eq win & NO_STOPS eq 0
7
    int3
7
    int3
8
  end if
8
  end if
9
}
9
}
10
 
10
 
11
macro wait
11
macro wait
12
{
12
{
13
if ~ SYS eq win
13
if ~ SYS eq win
14
local .nodrw,.ex
14
local .nodrw,.ex
15
   pusha
15
   pusha
16
   mcall 10
16
   mcall 10
17
   cmp   eax,1
17
   cmp   eax,1
18
   jne   .nodrw
18
   jne   .nodrw
19
   call  draw_window
19
   call  draw_window
20
 .nodrw:
20
 .nodrw:
21
   mcall 17
21
   mcall 17
22
 .ex:
22
 .ex:
23
   popa
23
   popa
24
end if
24
end if
25
}
25
}
26
 
26
 
27
macro rbits dest,cnt
27
macro rbits dest,cnt
28
{
28
{
29
    if ~ cnt eq
29
    if ~ cnt eq
30
      mov  ecx,cnt
30
      mov  ecx,cnt
31
    end if
31
    end if
32
    if   dest eq 0
32
    if   dest eq 0
33
      xor  eax,eax
33
      xor  eax,eax
34
    else
34
    else
35
      mov  eax,dest
35
      mov  eax,dest
36
    end if
36
    end if
37
    call read_bits
37
    call read_bits
38
}
38
}
39
 
39
 
40
 
40
 
41
macro rep_err cond_ok, result, msg
41
macro rep_err cond_ok, result, msg
42
{
42
{
43
  local .m
43
  local .m
44
    j#cond_ok .m
44
    j#cond_ok .m
45
   if ~ msg eq
45
   if ~ msg eq
46
    Msg msg
46
    Msg msg
47
   end if
47
   end if
48
    mov  edx,result
48
    mov  edx,result
49
    jmp  .err
49
    jmp  .err
50
  .m:
50
  .m:
51
}
51
}
52
 
52
 
53
macro memcpy_esi dest, count,_add
53
macro memcpy_esi dest, count,_add
54
{
54
{
55
    push esi
55
    push esi
56
  if ~ _add eq
56
  if ~ _add eq
57
    add  esi,_add
57
    add  esi,_add
58
  end if
58
  end if
59
    mov  edi,dest
59
    mov  edi,dest
60
    mov  ecx,count
60
    mov  ecx,count
61
    rep  movsb
61
    rep  movsb
62
    pop  esi
62
    pop  esi
63
}
63
}
64
 
64
 
65
DebugPrint:
65
DebugPrint:
66
; in: edx-asciiz string ptr
66
; in: edx-asciiz string ptr
67
    pusha
67
    pusha
68
if SYS eq win
68
if SYS eq win
69
    mov  ecx,255
69
    mov  ecx,255
70
    xor  eax,eax
70
    xor  eax,eax
71
    mov  edi,edx
71
    mov  edi,edx
72
    repne scasb
72
    repne scasb
73
    sub  edi,edx
73
    sub  edi,edx
74
    dec  edi
74
    dec  edi
75
    invoke WriteConsole,[cons],edx,edi,cparam1,NULL
75
    invoke WriteConsole,[cons],edx,edi,cparam1,NULL
76
else
76
else
77
    call debug_outstr
77
    call debug_outstr
78
end if
78
end if
79
    popa
79
    popa
80
    ret
80
    ret
81
 
81
 
82
macro DebugPrintDec
82
macro DebugPrintDec
83
{
83
{
84
if SYS eq win
84
if SYS eq win
85
    call int2str
85
    call int2str
86
    mov  edx,os_work
86
    mov  edx,os_work
87
    call DebugPrint
87
    call DebugPrint
88
else
88
else
89
    call debug_outdec
89
    call debug_outdec
90
end if
90
end if
91
}
91
}
92
 
92
 
93
macro Newline
93
macro Newline
94
{
94
{
95
if SYS eq win
95
if SYS eq win
96
    pusha
96
    pusha
97
    invoke WriteConsole,[cons],cr_lf,2,cparam1,NULL
97
    invoke WriteConsole,[cons],cr_lf,2,cparam1,NULL
98
    popa
98
    popa
99
else
99
else
100
    newline
100
    newline
101
end if
101
end if
102
}
102
}
103
 
103
 
104
Msgcall:
104
Msgcall:
105
; edx - msg number
105
; edx - msg number
106
  pusha
106
  pusha
107
  movzx edx,word[strs+edx*2]
107
  movzx edx,word[strs+edx*2]
108
  add  edx,msgs
108
  add  edx,msgs
109
  call DebugPrint
109
  call DebugPrint
110
  popa
110
  popa
111
  ret
111
  ret
112
 
112
 
113
macro Msg num
113
macro Msg num
114
{
114
{
115
 if ~ num eq edx
115
 if ~ num eq edx
116
   mov  edx,num
116
   mov  edx,num
117
 end if
117
 end if
118
   call Msgcall
118
   call Msgcall
119
}
119
}
120
 
120
 
121
MSG_COUNT=0
121
MSG_COUNT=0
122
macro str_table [str]
122
macro str_table [str]
123
{
123
{
124
 forward
124
 forward
125
   local label
125
   local label
126
   dw label-msgs
126
   dw label-msgs
127
 common
127
 common
128
   msgs:
128
   msgs:
129
 forward
129
 forward
130
   label db str,0
130
   label db str,0
131
   MSG_COUNT=MSG_COUNT+1
131
   MSG_COUNT=MSG_COUNT+1
132
}
132
}
133
 
133
 
134
 
134
 
135
 
135
 
136
strs:
136
strs:
137
if  language eq ru
137
if  language eq ru
138
str_table \
138
str_table \
139
   <'***  @RCHER - Deflate Unpacker  ***',13,10>,\  ;0
139
   <'***  @RCHER - Deflate Unpacker  ***',13,10>,\  ;0
140
   <'*** Copyright Wiland Inc., 2005 ***',13,10>,\  ;1
140
   <'*** Copyright Wiland Inc., 2005 ***',13,10>,\  ;1
141
   '” ©«®¢ ¢  à娢¥: ',\ ;2
141
   '” ©«®¢ ¢  à娢¥: ',\ ;2
142
   <'End of Directory ¤®á⨣­ãâ',13,10>,\  ;3
142
   <'End of Directory ¤®á⨣­ãâ',13,10>,\  ;3
143
   '¥â ä ©«  á â ª¨¬ ­®¬¥à®¬',\  ;4
143
   '¥â ä ©«  á â ª¨¬ ­®¬¥à®¬',\  ;4
144
   <'FindByNumber ŽŠ',13,10>,\  ;5
144
   <'FindByNumber ŽŠ',13,10>,\  ;5
145
   <'¥¢¥à­ë© ID ¡«®ª  • ä䬠­ ',13,10>,\  ;6
145
   <'¥¢¥à­ë© ID ¡«®ª  • ä䬠­ ',13,10>,\  ;6
146
   <'Žè¨¡ª  ¢ ª®¤ å • ä䬠­ !',13,10>,\  ;7
146
   <'Žè¨¡ª  ¢ ª®¤ å • ä䬠­ !',13,10>,\  ;7
147
   <13,10,' áç¥â â ¡«¨æë CRC32',13,10>,\  ;8
147
   <13,10,' áç¥â â ¡«¨æë CRC32',13,10>,\  ;8
148
   '.',\  ;9
148
   '.',\  ;9
149
   'Adler32',\  ;10
149
   'Adler32',\  ;10
150
   'CRC32',\ ;11
150
   'CRC32',\ ;11
151
   <'‡ ¢¥à襭®.',13,10>,\  ;12
151
   <'‡ ¢¥à襭®.',13,10>,\  ;12
152
   <'” ©« ¨¬¥¥â ­ã«¥¢ãî ¤«¨­ã, à á¯ ª®¢ª  ®â¬¥­¥­ .',13,10>,\  ;13
152
   <'” ©« ¨¬¥¥â ­ã«¥¢ãî ¤«¨­ã, à á¯ ª®¢ª  ®â¬¥­¥­ .',13,10>,\  ;13
153
   <'‘âà ­­ ï ¤«¨­  ä ©« -¨áâ®ç­¨ª . Žè¨¡ª  ¢ ¨¬¥­¨? Žâ¬¥­ .',13,10>,\  ;14
153
   <'‘âà ­­ ï ¤«¨­  ä ©« -¨áâ®ç­¨ª . Žè¨¡ª  ¢ ¨¬¥­¨? Žâ¬¥­ .',13,10>,\  ;14
154
   <'¥ GZIP  à娢',13,10>,\  ;15
154
   <'¥ GZIP  à娢',13,10>,\  ;15
155
   <'‘«¨èª®¬ ¡®«ì让 à §¬¥à ¢ë室­®£® ä ©« ',13,10>,\  ;16
155
   <'‘«¨èª®¬ ¡®«ì让 à §¬¥à ¢ë室­®£® ä ©« ',13,10>,\  ;16
156
   <"Žè¨¡ª  ¯à¨ à á¯ ª®¢ª¥.",13,10>,\  ; 17
156
   <"Žè¨¡ª  ¯à¨ à á¯ ª®¢ª¥.",13,10>,\  ; 17
157
   <'¥ à¨áã­®ª PNG',13,10>,\ ; 18
157
   <'¥ à¨áã­®ª PNG',13,10>,\ ; 18
158
   <13,10,'*¤'>,\  ;19
158
   <13,10,'*¤'>,\  ;19
159
   <13,10,'*á'>,\  ;20
159
   <13,10,'*á'>,\  ;20
160
   '¥®¦¨¤ ­­ë© ª®­¥æ ¡«®ª®¢ IDAT',\  ;21
160
   '¥®¦¨¤ ­­ë© ª®­¥æ ¡«®ª®¢ IDAT',\  ;21
161
   '„¥ä¨«ìâà æ¨ï:',\  ;22
161
   '„¥ä¨«ìâà æ¨ï:',\  ;22
162
   '”¨«ìâàë: None ',\  ;23
162
   '”¨«ìâàë: None ',\  ;23
163
   ' Sub ',\  ;24
163
   ' Sub ',\  ;24
164
   ' Up ',\  ;25
164
   ' Up ',\  ;25
165
   ' Avg ',\  ;26
165
   ' Avg ',\  ;26
166
   ' Paeth ',\  ;27
166
   ' Paeth ',\  ;27
167
   ' Žè¨¡®ª: ',\  ;28
167
   ' Žè¨¡®ª: ',\  ;28
168
   <'—¥à¥ááâà®ç­ë© PNG',13,10>,\  ;29
168
   <'—¥à¥ááâà®ç­ë© PNG',13,10>,\  ;29
169
   <'«®ª ¡¥§ ᦠâ¨ï',13,10>,\  ;30
169
   <'«®ª ¡¥§ ᦠâ¨ï',13,10>,\  ;30
170
   <'’¨¯ æ¢¥â  ­¥ ¯®¤¤¥à¦¨¢ ¥âáï',13,10>,\  ;31
170
   <'’¨¯ æ¢¥â  ­¥ ¯®¤¤¥à¦¨¢ ¥âáï',13,10>,\  ;31
171
   <'‚¢¥¤¨â¥ ¯ à®«ì ¤«ï § è¨ä஢ ­­®£® ä ©« :',13,10>,\  ;32
171
   <'‚¢¥¤¨â¥ ¯ à®«ì ¤«ï § è¨ä஢ ­­®£® ä ©« :',13,10>,\  ;32
172
   <'®¨áª ä ©« ...',13,10>,\  ;33
172
   <'®¨áª ä ©« ...',13,10>,\  ;33
173
   '¥ ¬®¤ã«ì SFX',\  ;34
173
   '¥ ¬®¤ã«ì SFX',\  ;34
174
   ' ­¥¢¥à­ ! ',\  ;35
174
   ' ­¥¢¥à­ ! ',\  ;35
175
   ' OK: ',\  ;36
175
   ' OK: ',\  ;36
176
   <'‡ ¯¨áì OUT.TXT',13,10>,\  ;37
176
   <'‡ ¯¨áì OUT.TXT',13,10>,\  ;37
177
   ' ',\  ;38
177
   ' ',\  ;38
178
   <'®¤£®â®¢ª  ¨§®¡à ¦¥­¨ï...',13,10>,\  ;39
178
   <'®¤£®â®¢ª  ¨§®¡à ¦¥­¨ï...',13,10>,\  ;39
179
   <'“ª ¦¨â¥ "R" ¤«ï ®¡à ¡®âª¨ áëàëå ¤ ­­ëå. Žâ¬¥­ .',13,10>,\  ;40
179
   <'“ª ¦¨â¥ "R" ¤«ï ®¡à ¡®âª¨ áëàëå ¤ ­­ëå. Žâ¬¥­ .',13,10>,\  ;40
180
   <'¥ 墠⠥⠯ ¬ïâ¨! Žâ¬¥­ .',13,10>,\  ; 41
180
   <'¥ 墠⠥⠯ ¬ïâ¨! Žâ¬¥­ .',13,10>,\  ; 41
181
   ' ',\  ;
181
   ' ',\  ;
182
   ' ',\  ;
182
   ' ',\  ;
183
   ' ',\  ;
183
   ' ',\  ;
184
   ' ',\  ;
184
   ' ',\  ;
185
   ' ',\  ;
185
   ' ',\  ;
186
   ' ',\  ;
186
   ' ',\  ;
187
   ' ',\  ;
187
   ' ',\  ;
188
   ' ',\  ;
188
   ' ',\  ;
189
   ' <- ­¥¨§¢¥áâ­ë© ¬¥â®¤ ᦠâ¨ï',\  ;50
189
   ' <- ­¥¨§¢¥áâ­ë© ¬¥â®¤ ᦠâ¨ï',\  ;50
190
   ' <- § è¨ä஢ ­',\  ;51
190
   ' <- § è¨ä஢ ­',\  ;51
191
   <'¥ ZIP  à娢',13,10> ; 52
191
   <'¥ ZIP  à娢',13,10> ; 52
192
else
192
else
193
str_table \
193
str_table \
194
   <'***  @RCHER - Deflate Unpacker  ***',13,10>,\  ;0
194
   <'***  @RCHER - Deflate Unpacker  ***',13,10>,\  ;0
195
   <'*** Copyright Wiland Inc., 2005 ***',13,10>,\  ;1
195
   <'*** Copyright Wiland Inc., 2005 ***',13,10>,\  ;1
196
   'Files in archive: ',\ ;2
196
   'Files in archive: ',\ ;2
197
   <'End of Directory reached',13,10>,\  ;3
197
   <'End of Directory reached',13,10>,\  ;3
198
   'No file has this number',\  ;4
198
   'No file has this number',\  ;4
199
   <'FindByNumber succeded',13,10>,\  ;5
199
   <'FindByNumber succeded',13,10>,\  ;5
200
   <'Invalid Huffman block ID',13,10>,\  ;6
200
   <'Invalid Huffman block ID',13,10>,\  ;6
201
   <'Error while getting Huffman codes!',13,10>,\  ;7
201
   <'Error while getting Huffman codes!',13,10>,\  ;7
202
   <13,10,'Rebuilding CRC32 table',13,10>,\  ;8
202
   <13,10,'Rebuilding CRC32 table',13,10>,\  ;8
203
   '.',\  ;9
203
   '.',\  ;9
204
   'Adler32',\  ;10
204
   'Adler32',\  ;10
205
   'CRC32',\ ;11
205
   'CRC32',\ ;11
206
   <'Job finished.',13,10>,\  ;12
206
   <'Job finished.',13,10>,\  ;12
207
   <'File of zero length, unpacking aborted.',13,10>,\  ;13
207
   <'File of zero length, unpacking aborted.',13,10>,\  ;13
208
   <'Source file has strange length, may be missing? Abort.',13,10>,\  ;14
208
   <'Source file has strange length, may be missing? Abort.',13,10>,\  ;14
209
   <'Not a GZIP archive',13,10>,\  ;15
209
   <'Not a GZIP archive',13,10>,\  ;15
210
   <'Destination file is too large for now',13,10>,\  ;16
210
   <'Destination file is too large for now',13,10>,\  ;16
211
   <"Can't unpack content.",13,10>,\  ; 17
211
   <"Can't unpack content.",13,10>,\  ; 17
212
   <'Not a PNG image',13,10>,\ ; 18
212
   <'Not a PNG image',13,10>,\ ; 18
213
   <13,10,'*d'>,\  ;19
213
   <13,10,'*d'>,\  ;19
214
   <13,10,'*s'>,\  ;20
214
   <13,10,'*s'>,\  ;20
215
   'Unexpected end of IDAT chunks',\  ;21
215
   'Unexpected end of IDAT chunks',\  ;21
216
   'Unfiltering:',\  ;22
216
   'Unfiltering:',\  ;22
217
   'Filters: None ',\  ;23
217
   'Filters: None ',\  ;23
218
   ' Sub ',\  ;24
218
   ' Sub ',\  ;24
219
   ' Up ',\  ;25
219
   ' Up ',\  ;25
220
   ' Avg ',\  ;26
220
   ' Avg ',\  ;26
221
   ' Paeth ',\  ;27
221
   ' Paeth ',\  ;27
222
   ' Invalid ',\  ;28
222
   ' Invalid ',\  ;28
223
   <'Interlaced PNG',13,10>,\  ;29
223
   <'Interlaced PNG',13,10>,\  ;29
224
   <'Stored block',13,10>,\  ;30
224
   <'Stored block',13,10>,\  ;30
225
   <'Color type not supported',13,10>,\  ;31
225
   <'Color type not supported',13,10>,\  ;31
226
   <'Enter password for encrypted file:',13,10>,\  ;32
226
   <'Enter password for encrypted file:',13,10>,\  ;32
227
   <'Searching for file...',13,10>,\  ;33
227
   <'Searching for file...',13,10>,\  ;33
228
   'Not a SFX module',\  ;34
228
   'Not a SFX module',\  ;34
229
   ' error! ',\  ;35
229
   ' error! ',\  ;35
230
   ' OK: ',\  ;36
230
   ' OK: ',\  ;36
231
   <'Creating OUT.TXT',13,10>,\  ;37
231
   <'Creating OUT.TXT',13,10>,\  ;37
232
   ' ',\  ;38
232
   ' ',\  ;38
233
   <'Preparing bitmap...',13,10>,\  ;39
233
   <'Preparing bitmap...',13,10>,\  ;39
234
   <'Specify "R" to force raw data. Abort.',13,10>,\  ;40
234
   <'Specify "R" to force raw data. Abort.',13,10>,\  ;40
235
   <'Not enough memory! Abort.',13,10>,\  ;
235
   <'Not enough memory! Abort.',13,10>,\  ;
236
   ' ',\  ;
236
   ' ',\  ;
237
   ' ',\  ;
237
   ' ',\  ;
238
   ' ',\  ;
238
   ' ',\  ;
239
   ' ',\  ;
239
   ' ',\  ;
240
   ' ',\  ;
240
   ' ',\  ;
241
   ' ',\  ;
241
   ' ',\  ;
242
   ' ',\  ;
242
   ' ',\  ;
243
   ' ',\  ;
243
   ' ',\  ;
244
   ' <- unknown compression method',\  ;50
244
   ' <- unknown compression method',\  ;50
245
   ' <- encrypted',\  ;51
245
   ' <- encrypted',\  ;51
246
   <'Not a ZIP archive',13,10> ; 52
246
   <'Not a ZIP archive',13,10> ; 52
247
end if
247
end if
248
 
248
 
249
macro opendialog redproc,openoff,erroff,path
249
macro opendialog redproc,openoff,erroff,path
250
{
250
{
251
local new_d, get_loops, dlg_pid_get, DLGPID, num_of_proc
251
local new_d, get_loops, dlg_pid_get, DLGPID, num_of_proc
252
local run_fileinfo, param
252
local run_fileinfo, param
253
local getmesloop, loox, mred, mkey, mbutton, mgetmes
253
local getmesloop, loox, mred, mkey, mbutton, mgetmes
254
local dlg_is_work, ready
254
local dlg_is_work, ready
255
;
255
;
256
; STEP 1 Run SYSXTREE with parametrs MYPID 4 bytes in dec,
256
; STEP 1 Run SYSXTREE with parametrs MYPID 4 bytes in dec,
257
; 1 byte space, 1 byte type of dialog (O - Open ,S - Save)
257
; 1 byte space, 1 byte type of dialog (O - Open ,S - Save)
258
;
258
;
259
 
259
 
260
    cld
260
    cld
261
;;    mov esi,path
261
;;    mov esi,path
262
    mov edi,path
262
    mov edi,path
263
    xor eax,eax
263
    xor eax,eax
264
    mov ecx,(1024+16)/4
264
    mov ecx,(1024+16)/4
265
    rep stosd
265
    rep stosd
266
 
266
 
267
;mov [get_loops],0
267
;mov [get_loops],0
268
mov [dlg_pid_get],0
268
mov [dlg_pid_get],0
269
 
269
 
270
; Get my PID in dec format 4 bytes
270
; Get my PID in dec format 4 bytes
271
    mcall 9,os_work,-1
271
    mcall 9,os_work,-1
272
 
272
 
273
; convert eax bin to param dec
273
; convert eax bin to param dec
274
    mov eax,dword [os_work+30]  ;offset of myPID
274
    mov eax,dword [os_work+30]  ;offset of myPID
275
    mov edi,param+4-1            ;offset to 4 bytes
275
    mov edi,param+4-1            ;offset to 4 bytes
276
    mov ecx,4
276
    mov ecx,4
277
    mov ebx,10
277
    mov ebx,10
278
    cld
278
    cld
279
new_d:
279
new_d:
280
    xor edx,edx
280
    xor edx,edx
281
    div ebx
281
    div ebx
282
    add dl,'0'
282
    add dl,'0'
283
    mov [edi],dl
283
    mov [edi],dl
284
    dec edi
284
    dec edi
285
    loop new_d
285
    loop new_d
286
 
286
 
287
; write 1 byte space to param
287
; write 1 byte space to param
288
    mov [param+4],byte 32    ;Space for next parametr
288
    mov [param+4],byte 32    ;Space for next parametr
289
; and 1 byte type of dialog to param
289
; and 1 byte type of dialog to param
290
    mov [param+5],byte 'O'   ;Get Open dialog (Use 'S' for Save dialog)
290
    mov [param+5],byte 'O'   ;Get Open dialog (Use 'S' for Save dialog)
291
 
291
 
292
;
292
;
293
; STEP2 prepare IPC area for get messages
293
; STEP2 prepare IPC area for get messages
294
;
294
;
295
 
295
 
296
; prepare IPC area
296
; prepare IPC area
297
    mov [path],dword 0
297
    mov [path],dword 0
298
    mov [path+4],dword 8
298
    mov [path+4],dword 8
299
 
299
 
300
; define IPC memory
300
; define IPC memory
301
    mov eax,60
301
    mov eax,60
302
    mov ebx,1        ; define IPC
302
    mov ebx,1        ; define IPC
303
    mov ecx,path     ; offset of area
303
    mov ecx,path     ; offset of area
304
    mov edx,1024+16  ; size
304
    mov edx,1024+16  ; size
305
    mcall
305
    mcall
306
 
306
 
307
    mcall 40,1000111b
307
    mcall 40,1000111b
308
;
308
;
309
; STEP 3 run SYSTEM XTREE with parameters
309
; STEP 3 run SYSTEM XTREE with parameters
310
;
310
;
311
 
311
 
312
    mcall 70,run_fileinfo
312
    mcall 70,run_fileinfo
313
 
313
 
314
    call redproc
314
    call redproc
315
 
315
 
316
    mov [get_loops],0
316
    mov [get_loops],0
317
getmesloop:
317
getmesloop:
318
    mov eax,23
318
    mov eax,23
319
    mov ebx,50     ;0.5 sec
319
    mov ebx,50     ;0.5 sec
320
    mcall
320
    mcall
321
        dec     eax
321
        dec     eax
322
        jz      mred
322
        jz      mred
323
        dec     eax
323
        dec     eax
324
        jz      mkey
324
        jz      mkey
325
        dec     eax
325
        dec     eax
326
        jz      mbutton
326
        jz      mbutton
327
        cmp     al, 7-3
327
        cmp     al, 7-3
328
        jz      mgetmes
328
        jz      mgetmes
329
 
329
 
330
; Get number of procces
330
; Get number of procces
331
    mcall 9,os_work,-1
331
    mcall 9,os_work,-1
332
    mov ebp,eax
332
    mov ebp,eax
333
 
333
 
334
loox:
334
loox:
335
    mcall 9,os_work,ebp
335
    mcall 9,os_work,ebp
336
    mov eax,[DLGPID]
336
    mov eax,[DLGPID]
337
    cmp dword[os_work+30],eax    ;IF Dialog find
337
    cmp dword[os_work+30],eax    ;IF Dialog find
338
    je  dlg_is_work          ;jmp to dlg_is_work
338
    je  dlg_is_work          ;jmp to dlg_is_work
339
    dec ebp
339
    dec ebp
340
    jnz loox
340
    jnz loox
341
 
341
 
342
    jmp erroff
342
    jmp erroff
343
 
343
 
344
dlg_is_work:
344
dlg_is_work:
345
    cmp word[os_work+50],word 9 ;If slot state 9 - dialog is terminated
345
    cmp word[os_work+50],word 9 ;If slot state 9 - dialog is terminated
346
    je  erroff                 ;TESTODP2 terminated too
346
    je  erroff                 ;TESTODP2 terminated too
347
 
347
 
348
    cmp [dlg_pid_get],dword 1
348
    cmp [dlg_pid_get],dword 1
349
    je  getmesloop
349
    je  getmesloop
350
    inc [get_loops]
350
    inc [get_loops]
351
    cmp [get_loops],4  ;2 sec if DLG_PID not get, TESTOP2  terminated
351
    cmp [get_loops],4  ;2 sec if DLG_PID not get, TESTOP2  terminated
352
    jae erroff
352
    jae erroff
353
    jmp getmesloop
353
    jmp getmesloop
354
 
354
 
355
mred:
355
mred:
356
    call redproc
356
    call redproc
357
    jmp  getmesloop
357
    jmp  getmesloop
358
mkey:
358
mkey:
359
    mcall 2  ; read (eax=2)
359
    mcall 2  ; read (eax=2)
360
    jmp  getmesloop
360
    jmp  getmesloop
361
mbutton:
361
mbutton:
362
    mov  eax,17                 ; get id
362
    mov  eax,17                 ; get id
363
    mcall
363
    mcall
364
    cmp  ah,1                   ; button id=1 ?
364
    cmp  ah,1                   ; button id=1 ?
365
    jne  getmesloop
365
    jne  getmesloop
366
    mov  eax,-1                 ; close this program
366
    mov  eax,-1                 ; close this program
367
    mcall
367
    mcall
368
mgetmes:
368
mgetmes:
369
; If dlg_pid_get then second message get jmp to still
369
; If dlg_pid_get then second message get jmp to still
370
    cmp  [dlg_pid_get],dword 1
370
    cmp  [dlg_pid_get],dword 1
371
    je   ready
371
    je   ready
372
 
372
 
373
; First message is number of PID SYSXTREE dialog
373
; First message is number of PID SYSXTREE dialog
374
 
374
 
375
; convert PID dec to PID bin
375
; convert PID dec to PID bin
376
    movzx eax,byte [path+16]
376
    movzx eax,byte [path+16]
377
    sub eax,48
377
    sub eax,48
378
    imul eax,10
378
    imul eax,10
379
    movzx ebx,byte [path+16+1]
379
    movzx ebx,byte [path+16+1]
380
    add eax,ebx
380
    add eax,ebx
381
    sub eax,48
381
    sub eax,48
382
    imul eax,10
382
    imul eax,10
383
    movzx ebx,byte [path+16+2]
383
    movzx ebx,byte [path+16+2]
384
    add eax,ebx
384
    add eax,ebx
385
    sub eax,48
385
    sub eax,48
386
    imul eax,10
386
    imul eax,10
387
    movzx ebx,byte [path+16+3]
387
    movzx ebx,byte [path+16+3]
388
    add eax,ebx
388
    add eax,ebx
389
    sub eax,48
389
    sub eax,48
390
    mov [DLGPID],eax
390
    mov [DLGPID],eax
391
 
391
 
392
; Claear and prepare IPC area for next message
392
; Claear and prepare IPC area for next message
393
    mov [path],dword 0
393
    mov [path],dword 0
394
    mov [path+4],dword 8
394
    mov [path+4],dword 8
395
    mov [path+8],dword 0
395
    mov [path+8],dword 0
396
    mov [path+12],dword 0
396
    mov [path+12],dword 0
397
    mov [path+16],dword 0
397
    mov [path+16],dword 0
398
 
398
 
399
; Set dlg_pid_get for get next message
399
; Set dlg_pid_get for get next message
400
    mov [dlg_pid_get],dword 1
400
    mov [dlg_pid_get],dword 1
401
    call redproc   ;show DLG_PID
401
    call redproc   ;show DLG_PID
402
    jmp  getmesloop
402
    jmp  getmesloop
403
 
403
 
404
ready:
404
ready:
405
;
405
;
406
; The second message get
406
; The second message get
407
; Second message is 1024 bytes path to SAVE/OPEN file
407
; Second message is 1024 bytes path to SAVE/OPEN file
408
; shl path string on 16 bytes
408
; shl path string on 16 bytes
409
;
409
;
410
    cld
410
    cld
411
    mov esi,path+16
411
    mov esi,path+16
412
    mov edi,path
412
    mov edi,path
413
    mov ecx,1024/4
413
    mov ecx,1024/4
414
    rep movsd
414
    rep movsd
415
    mov [edi],byte 0
415
    mov [edi],byte 0
416
 
416
 
417
    jmp openoff
417
    jmp openoff
418
 
418
 
419
 
419
 
420
; DATA AREA
420
; DATA AREA
421
get_loops   dd 0
421
get_loops   dd 0
422
dlg_pid_get dd 0
422
dlg_pid_get dd 0
423
DLGPID      dd 0
423
DLGPID      dd 0
424
 
424
 
425
param:
425
param:
426
   dd 0    ; My dec PID
426
   dd 0    ; My dec PID
427
   dd 0,0  ; Type of dialog
427
   dd 0,0  ; Type of dialog
428
 
428
 
429
run_fileinfo:
429
run_fileinfo:
430
 dd 7
430
 dd 7
431
 dd 0
431
 dd 0
432
 dd param
432
 dd param
433
 dd 0
433
 dd 0
434
 dd 0
434
 dd 0
435
;run_filepath
435
;run_filepath
436
 db '/RD/1/SYSXTREE',0
436
 db '/sys/SYSXTREE',0
437
 
437
 
438
}
438
}