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
lang equ ru ; ru en fr ge fi
1
lang equ ru ; ru en fr ge fi
2
 
2
 
3
;
3
;
4
;   Assembler
4
;   Assembler
5
;     SMALL
5
;     SMALL
6
;       CODE
6
;       CODE
7
;         Libary
7
;         Libary
8
;
8
;
9
;  Ver 0.14 By Pavlushin Evgeni (RUSSIA)
9
;  Ver 0.14 By Pavlushin Evgeni (RUSSIA)
10
;  www.waptap@mail.ru
10
;  www.waptap@mail.ru
11
 
11
 
12
;Please compile aplications on FASM ver1.54 or higer!!!
12
;Please compile aplications on FASM ver1.54 or higer!!!
13
 
13
 
14
;InfoList
14
;InfoList
15
;0.01 scank,putpix,puttxt
15
;0.01 scank,putpix,puttxt
16
;0.02 label,random,colors
16
;0.02 label,random,colors
17
;0.03 window,startwd,endwd,attributes
17
;0.03 window,startwd,endwd,attributes
18
;0.04 close,delay,scevent ~30.04.2004
18
;0.04 close,delay,scevent ~30.04.2004
19
;0.05 small random, ~04.05.2004
19
;0.05 small random, ~04.05.2004
20
;0.06 wtevent ~09.05.2004
20
;0.06 wtevent ~09.05.2004
21
;0.07 timeevent ~23.05.2004
21
;0.07 timeevent ~23.05.2004
22
;0.08 txtput ~14.06.2004
22
;0.08 txtput ~14.06.2004
23
;0.09 opendialog,savedialog ~20.06.2004
23
;0.09 opendialog,savedialog ~20.06.2004
24
;0.10 wordstoreg by halyavin, add at ~30.08.2004
24
;0.10 wordstoreg by halyavin, add at ~30.08.2004
25
; random bug deleted eax is use.
25
; random bug deleted eax is use.
26
;0.11 loadfile from me +puttxt bug del ~07.09.2004
26
;0.11 loadfile from me +puttxt bug del ~07.09.2004
27
;0.12 open/save dialog ~13.09.2004
27
;0.12 open/save dialog ~13.09.2004
28
;0.13 dialogs bugs deleted
28
;0.13 dialogs bugs deleted
29
;0.14 drawlbut ~03.10.2004
29
;0.14 drawlbut ~03.10.2004
30
 
30
 
31
; LOADFILE
31
; LOADFILE
32
; (SYNTAX)  LOADFILE 'full_path_to_file',file_load_area,file_temp_area
32
; (SYNTAX)  LOADFILE 'full_path_to_file',file_load_area,file_temp_area
33
; (SAMPLE)  LOADFILE '/rd/1/clock.bmp',load_area,temp_area
33
; (SAMPLE)  LOADFILE '/rd/1/clock.bmp',load_area,temp_area
34
 
34
 
35
macro loadfile file_name,file_load_area,file_temp_area
35
macro loadfile file_name,file_load_area,file_temp_area
36
{
36
{
37
local open,fileinfo,string
37
local open,fileinfo,string
38
    jmp open
38
    jmp open
39
fileinfo:
39
fileinfo:
40
    dd 0
40
    dd 0
41
    dd 0
41
    dd 0
42
    dd 1
42
    dd 1
43
    dd file_load_area
43
    dd file_load_area
44
    dd file_temp_area
44
    dd file_temp_area
45
string:
45
string:
46
    db file_name,0
46
    db file_name,0
47
open:
47
open:
48
    mov  dword [fileinfo+8],1 ; how many blocks to read (1)
48
    mov  dword [fileinfo+8],1 ; how many blocks to read (1)
49
    mov  eax,58
49
    mov  eax,58
50
    mov  ebx,fileinfo
50
    mov  ebx,fileinfo
51
    mcall
51
    mcall
52
    mov  eax,[file_load_area+2]
52
    mov  eax,[file_load_area+2]
53
    shr  eax,9 ; ¯®¤¥«¨¬ ­  512 ¨ ¯à¨¡ ¢¨¬ 1 - ¯®«ã稬 ç¨á«® ¡«®ª®¢
53
    shr  eax,9 ; ¯®¤¥«¨¬ ­  512 ¨ ¯à¨¡ ¢¨¬ 1 - ¯®«ã稬 ç¨á«® ¡«®ª®¢
54
    inc  eax
54
    inc  eax
55
    mov  dword [fileinfo+8],eax
55
    mov  dword [fileinfo+8],eax
56
    mov  eax,58
56
    mov  eax,58
57
    mov  ebx,fileinfo
57
    mov  ebx,fileinfo
58
    mcall
58
    mcall
59
}
59
}
60
 
60
 
61
 
61
 
62
macro wordstoreg reg,hiword,loword
62
macro wordstoreg reg,hiword,loword
63
{
63
{
64
if  hiword eqtype 0 & loword eqtype 0
64
if  hiword eqtype 0 & loword eqtype 0
65
    mov  reg,(hiword)*65536+(loword)
65
    mov  reg,(hiword)*65536+(loword)
66
else if hiword eqtype 12 & loword eqtype eax
66
else if hiword eqtype 12 & loword eqtype eax
67
    mov  reg,(hiword)*65536
67
    mov  reg,(hiword)*65536
68
    add  reg,loword
68
    add  reg,loword
69
else if hiword eqtype 0 & loword eqtype [123]
69
else if hiword eqtype 0 & loword eqtype [123]
70
    mov  reg,(hiword)*65536
70
    mov  reg,(hiword)*65536
71
    add  reg,loword
71
    add  reg,loword
72
else if (hiword eq ) & (loword eq )
72
else if (hiword eq ) & (loword eq )
73
else
73
else
74
    mov  reg,hiword
74
    mov  reg,hiword
75
    shl  reg,16
75
    shl  reg,16
76
    add  reg,loword
76
    add  reg,loword
77
end if
77
end if
78
}
78
}
79
 
79
 
80
 
80
 
81
; DRAW BUTTON with label
81
; DRAW BUTTON with label
82
 
82
 
83
macro drawlbut x,y,xs,ys,text,id,bcolor,tcolor
83
macro drawlbut x,y,xs,ys,text,id,bcolor,tcolor
84
{
84
{
85
local asd,lab
85
local asd,lab
86
    jmp asd
86
    jmp asd
87
lab db  text                 ;arg label
87
lab db  text                 ;arg label
88
asd:
88
asd:
89
    wordstoreg ebx,x,xs
89
    wordstoreg ebx,x,xs
90
    wordstoreg ecx,y,ys
90
    wordstoreg ecx,y,ys
91
    mov edx,id
91
    mov edx,id
92
    mov esi,bcolor
92
    mov esi,bcolor
93
    mov eax,8
93
    mov eax,8
94
    mcall
94
    mcall
95
 
95
 
96
    mov eax,asd-lab          ;calc size
96
    mov eax,asd-lab          ;calc size
97
    mov ebx,6
97
    mov ebx,6
98
    mul ebx
98
    mul ebx
99
    mov esi,eax
99
    mov esi,eax
100
 
100
 
101
    mov eax,xs
101
    mov eax,xs
102
    sub eax,esi
102
    sub eax,esi
103
    shr eax,1
103
    shr eax,1
104
    add eax,x
104
    add eax,x
105
 
105
 
106
    mov edx,ys
106
    mov edx,ys
107
    sub edx,7
107
    sub edx,7
108
    shr edx,1
108
    shr edx,1
109
    add edx,y
109
    add edx,y
110
 
110
 
111
    mov ebx,eax
111
    mov ebx,eax
112
    shl ebx,16
112
    shl ebx,16
113
    add ebx,edx
113
    add ebx,edx
114
 
114
 
115
    mov ecx,tcolor             ;arg4 color
115
    mov ecx,tcolor             ;arg4 color
116
    mov edx,lab
116
    mov edx,lab
117
    mov esi,asd-lab          ;calc size
117
    mov esi,asd-lab          ;calc size
118
    mov eax,4
118
    mov eax,4
119
    mcall
119
    mcall
120
}
120
}
121
 
121
 
122
 
122
 
123
macro opendialog redproc,openoff,erroff,path
123
macro opendialog redproc,openoff,erroff,path
124
{
124
{
125
local new_d, get_loops, dlg_pid_get, DLGPID, num_of_proc
125
local new_d, get_loops, dlg_pid_get, DLGPID, num_of_proc
126
local run_fileinfo, param
126
local run_fileinfo, param
127
local getmesloop, loox, mred, mkey, mbutton, mgetmes
127
local getmesloop, loox, mred, mkey, mbutton, mgetmes
128
local dlg_is_work, ready, procinfo
128
local dlg_is_work, ready, procinfo
129
;
129
;
130
; STEP 1 Run SYSXTREE with parametrs MYPID 4 bytes in dec,
130
; STEP 1 Run SYSXTREE with parametrs MYPID 4 bytes in dec,
131
; 1 byte space, 1 byte type of dialog (O - Open ,S - Save)
131
; 1 byte space, 1 byte type of dialog (O - Open ,S - Save)
132
;
132
;
133
 
133
 
134
    cld
134
    cld
135
;;    mov esi,path
135
;;    mov esi,path
136
    mov edi,path
136
    mov edi,path
137
    mov eax,0
137
    mov eax,0
138
    mov ecx,200
138
    mov ecx,200
139
    rep stosb
139
    rep stosb
140
 
140
 
141
;mov [get_loops],0
141
;mov [get_loops],0
142
mov [dlg_pid_get],0
142
mov [dlg_pid_get],0
143
 
143
 
144
; Get my PID in dec format 4 bytes
144
; Get my PID in dec format 4 bytes
145
    mov eax,9
145
    mov eax,9
146
    mov ebx,procinfo
146
    mov ebx,procinfo
147
    mov ecx,-1
147
    mov ecx,-1
148
    mcall
148
    mcall
149
 
149
 
150
; convert eax bin to param dec
150
; convert eax bin to param dec
151
    mov eax,dword [procinfo+30]  ;offset of myPID
151
    mov eax,dword [procinfo+30]  ;offset of myPID
152
    mov edi,param+4-1            ;offset to 4 bytes
152
    mov edi,param+4-1            ;offset to 4 bytes
153
    mov ecx,4
153
    mov ecx,4
154
    mov ebx,10
154
    mov ebx,10
155
    cld
155
    cld
156
new_d:
156
new_d:
157
    xor edx,edx
157
    xor edx,edx
158
    div ebx
158
    div ebx
159
    add dl,'0'
159
    add dl,'0'
160
    mov [edi],dl
160
    mov [edi],dl
161
    dec edi
161
    dec edi
162
    loop new_d
162
    loop new_d
163
 
163
 
164
; wirite 1 byte space to param
164
; wirite 1 byte space to param
165
    mov [param+4],byte 32    ;Space for next parametr
165
    mov [param+4],byte 32    ;Space for next parametr
166
; and 1 byte type of dialog to param
166
; and 1 byte type of dialog to param
167
    mov [param+5],byte 'O'   ;Get Open dialog (Use 'S' for Save dialog)
167
    mov [param+5],byte 'O'   ;Get Open dialog (Use 'S' for Save dialog)
168
 
168
 
169
;
169
;
170
; STEP2 prepare IPC area for get messages
170
; STEP2 prepare IPC area for get messages
171
;
171
;
172
 
172
 
173
; prepare IPC area
173
; prepare IPC area
174
    mov [path],dword 0
174
    mov [path],dword 0
175
    mov [path+4],dword 8
175
    mov [path+4],dword 8
176
 
176
 
177
; define IPC memory
177
; define IPC memory
178
    mov eax,60
178
    mov eax,60
179
    mov ebx,1        ; define IPC
179
    mov ebx,1        ; define IPC
180
    mov ecx,path     ; offset of area
180
    mov ecx,path     ; offset of area
181
    mov edx,150      ; size 150 bytes
181
    mov edx,150      ; size 150 bytes
182
    mcall
182
    mcall
183
 
183
 
184
; change wanted events list 7-bit IPC event
184
; change wanted events list 7-bit IPC event
185
    mov eax,40
185
    mov eax,40
186
    mov ebx,01000111b
186
    mov ebx,01000111b
187
    mcall
187
    mcall
188
 
188
 
189
;
189
;
190
; STEP 3 run SYSTEM XTREE with parameters
190
; STEP 3 run SYSTEM XTREE with parameters
191
;
191
;
192
 
192
 
193
    mov eax,58
193
    mov eax,58
194
    mov ebx,run_fileinfo
194
    mov ebx,run_fileinfo
195
    mcall
195
    mcall
196
 
196
 
197
    call redproc
197
    call redproc
198
 
198
 
199
    mov [get_loops],0
199
    mov [get_loops],0
200
getmesloop:
200
getmesloop:
201
    mov eax,23
201
    mov eax,23
202
    mov ebx,50     ;0.5 sec
202
    mov ebx,50     ;0.5 sec
203
    mcall
203
    mcall
204
 
204
 
205
    cmp eax,1
205
    cmp eax,1
206
    je  mred
206
    je  mred
207
    cmp eax,2
207
    cmp eax,2
208
    je  mkey
208
    je  mkey
209
    cmp eax,3
209
    cmp eax,3
210
    je  mbutton
210
    je  mbutton
211
    cmp eax,7
211
    cmp eax,7
212
    je  mgetmes
212
    je  mgetmes
213
 
213
 
214
; Get number of procces
214
; Get number of procces
215
    mov ebx,procinfo
215
    mov ebx,procinfo
216
    mov ecx,-1
216
    mov ecx,-1
217
    mov eax,9
217
    mov eax,9
218
    mcall
218
    mcall
219
    mov ebp,eax
219
    mov ebp,eax
220
 
220
 
221
loox:
221
loox:
222
    mov eax,9
222
    mov eax,9
223
    mov ebx,procinfo
223
    mov ebx,procinfo
224
    mov ecx,ebp
224
    mov ecx,ebp
225
    mcall
225
    mcall
226
    mov eax,[DLGPID]
226
    mov eax,[DLGPID]
227
    cmp [procinfo+30],eax    ;IF Dialog find
227
    cmp [procinfo+30],eax    ;IF Dialog find
228
    je  dlg_is_work          ;jmp to dlg_is_work
228
    je  dlg_is_work          ;jmp to dlg_is_work
229
    dec ebp
229
    dec ebp
230
    jnz loox
230
    jnz loox
231
 
231
 
232
    jmp erroff
232
    jmp erroff
233
 
233
 
234
dlg_is_work:
234
dlg_is_work:
235
    cmp [procinfo+50],word 9 ;If slot state 9 - dialog is terminated
235
    cmp [procinfo+50],word 9 ;If slot state 9 - dialog is terminated
236
    je  erroff                 ;TESTODP2 terminated too
236
    je  erroff                 ;TESTODP2 terminated too
237
 
237
 
238
    cmp [dlg_pid_get],dword 1
238
    cmp [dlg_pid_get],dword 1
239
    je  getmesloop
239
    je  getmesloop
240
    inc [get_loops]
240
    inc [get_loops]
241
    cmp [get_loops],4  ;2 sec if DLG_PID not get, TESTOP2  terminated
241
    cmp [get_loops],4  ;2 sec if DLG_PID not get, TESTOP2  terminated
242
    jae erroff
242
    jae erroff
243
    jmp getmesloop
243
    jmp getmesloop
244
 
244
 
245
mred:
245
mred:
246
    call redproc
246
    call redproc
247
    jmp  getmesloop
247
    jmp  getmesloop
248
mkey:
248
mkey:
249
    mov  eax,2
249
    mov  eax,2
250
    mcall                   ; read (eax=2)
250
    mcall                   ; read (eax=2)
251
    jmp  getmesloop
251
    jmp  getmesloop
252
mbutton:
252
mbutton:
253
    mov  eax,17                 ; get id
253
    mov  eax,17                 ; get id
254
    mcall
254
    mcall
255
    cmp  ah,1                   ; button id=1 ?
255
    cmp  ah,1                   ; button id=1 ?
256
    jne  getmesloop
256
    jne  getmesloop
257
    mov  eax,-1                 ; close this program
257
    mov  eax,-1                 ; close this program
258
    mcall
258
    mcall
259
mgetmes:
259
mgetmes:
260
 
260
 
261
; If dlg_pid_get then second message get jmp to still
261
; If dlg_pid_get then second message get jmp to still
262
    cmp  [dlg_pid_get],dword 1
262
    cmp  [dlg_pid_get],dword 1
263
    je   ready
263
    je   ready
264
 
264
 
265
; First message is number of PID SYSXTREE dialog
265
; First message is number of PID SYSXTREE dialog
266
 
266
 
267
; convert PID dec to PID bin
267
; convert PID dec to PID bin
268
    movzx eax,byte [path+16]
268
    movzx eax,byte [path+16]
269
    sub eax,48
269
    sub eax,48
270
    imul eax,10
270
    imul eax,10
271
    movzx ebx,byte [path+16+1]
271
    movzx ebx,byte [path+16+1]
272
    add eax,ebx
272
    add eax,ebx
273
    sub eax,48
273
    sub eax,48
274
    imul eax,10
274
    imul eax,10
275
    movzx ebx,byte [path+16+2]
275
    movzx ebx,byte [path+16+2]
276
    add eax,ebx
276
    add eax,ebx
277
    sub eax,48
277
    sub eax,48
278
    imul eax,10
278
    imul eax,10
279
    movzx ebx,byte [path+16+3]
279
    movzx ebx,byte [path+16+3]
280
    add eax,ebx
280
    add eax,ebx
281
    sub eax,48
281
    sub eax,48
282
    mov [DLGPID],eax
282
    mov [DLGPID],eax
283
 
283
 
284
; Claear and prepare IPC area for next message
284
; Claear and prepare IPC area for next message
285
    mov [path],dword 0
285
    mov [path],dword 0
286
    mov [path+4],dword 8
286
    mov [path+4],dword 8
287
    mov [path+8],dword 0
287
    mov [path+8],dword 0
288
    mov [path+12],dword 0
288
    mov [path+12],dword 0
289
    mov [path+16],dword 0
289
    mov [path+16],dword 0
290
 
290
 
291
; Set dlg_pid_get for get next message
291
; Set dlg_pid_get for get next message
292
    mov [dlg_pid_get],dword 1
292
    mov [dlg_pid_get],dword 1
293
    call redproc   ;show DLG_PID
293
    call redproc   ;show DLG_PID
294
    jmp  getmesloop
294
    jmp  getmesloop
295
 
295
 
296
ready:
296
ready:
297
;
297
;
298
; The second message get
298
; The second message get
299
; Second message is 100 bytes path to SAVE/OPEN file
299
; Second message is 100 bytes path to SAVE/OPEN file
300
; shl path string on 16 bytes
300
; shl path string on 16 bytes
301
;
301
;
302
    cld
302
    cld
303
    mov esi,path+16
303
    mov esi,path+16
304
    mov edi,path
304
    mov edi,path
305
    mov ecx,200
305
    mov ecx,200
306
    rep movsb
306
    rep movsb
307
    mov [edi],byte 0
307
    mov [edi],byte 0
308
 
308
 
309
    jmp openoff
309
    jmp openoff
310
 
310
 
311
 
311
 
312
; DATA AREA
312
; DATA AREA
313
get_loops   dd 0
313
get_loops   dd 0
314
dlg_pid_get dd 0
314
dlg_pid_get dd 0
315
DLGPID      dd 0
315
DLGPID      dd 0
316
 
316
 
317
param:
317
param:
318
   dd 0    ; My dec PID
318
   dd 0    ; My dec PID
319
   dd 0,0  ; Type of dialog
319
   dd 0,0  ; Type of dialog
320
 
320
 
321
run_fileinfo:
321
run_fileinfo:
322
 dd 16
322
 dd 16
323
 dd 0
323
 dd 0
324
 dd param
324
 dd param
325
 dd 0
325
 dd 0
326
 dd procinfo ; 0x10000
326
 dd procinfo ; 0x10000
327
;run_filepath
327
;run_filepath
328
 db '/RD/1/SYSXTREE',0
328
 db '/sys/SYSXTREE',0
329
 
329
 
330
procinfo:
330
procinfo:
331
times 256 db 0
331
times 256 db 0
332
}
332
}
333
 
333
 
334
 
334
 
335
macro savedialog redproc,openoff,erroff,path
335
macro savedialog redproc,openoff,erroff,path
336
{
336
{
337
local new_d, get_loops, dlg_pid_get, DLGPID, num_of_proc
337
local new_d, get_loops, dlg_pid_get, DLGPID, num_of_proc
338
local run_fileinfo, run_filepath, param
338
local run_fileinfo, run_filepath, param
339
local getmesloop, loox, mred, mkey, mbutton, mgetmes
339
local getmesloop, loox, mred, mkey, mbutton, mgetmes
340
local dlg_is_work, ready, procinfo
340
local dlg_is_work, ready, procinfo
341
;
341
;
342
; STEP 1 Run SYSXTREE with parametrs MYPID 4 bytes in dec,
342
; STEP 1 Run SYSXTREE with parametrs MYPID 4 bytes in dec,
343
; 1 byte space, 1 byte type of dialog (O - Open ,S - Save)
343
; 1 byte space, 1 byte type of dialog (O - Open ,S - Save)
344
;
344
;
345
 
345
 
346
    cld
346
    cld
347
;;    mov esi,path
347
;;    mov esi,path
348
    mov edi,path
348
    mov edi,path
349
    mov eax,0
349
    mov eax,0
350
    mov ecx,200
350
    mov ecx,200
351
    rep stosb
351
    rep stosb
352
 
352
 
353
;mov [get_loops],0
353
;mov [get_loops],0
354
mov [dlg_pid_get],0
354
mov [dlg_pid_get],0
355
 
355
 
356
; Get my PID in dec format 4 bytes
356
; Get my PID in dec format 4 bytes
357
    mov eax,9
357
    mov eax,9
358
    mov ebx,procinfo
358
    mov ebx,procinfo
359
    mov ecx,-1
359
    mov ecx,-1
360
    mcall
360
    mcall
361
 
361
 
362
; convert eax bin to param dec
362
; convert eax bin to param dec
363
    mov eax,dword [procinfo+30]  ;offset of myPID
363
    mov eax,dword [procinfo+30]  ;offset of myPID
364
    mov edi,param+4-1            ;offset to 4 bytes
364
    mov edi,param+4-1            ;offset to 4 bytes
365
    mov ecx,4
365
    mov ecx,4
366
    mov ebx,10
366
    mov ebx,10
367
    cld
367
    cld
368
new_d:
368
new_d:
369
    xor edx,edx
369
    xor edx,edx
370
    div ebx
370
    div ebx
371
    add dl,'0'
371
    add dl,'0'
372
    mov [edi],dl
372
    mov [edi],dl
373
    dec edi
373
    dec edi
374
    loop new_d
374
    loop new_d
375
 
375
 
376
; wirite 1 byte space to param
376
; wirite 1 byte space to param
377
    mov [param+4],byte 32    ;Space for next parametr
377
    mov [param+4],byte 32    ;Space for next parametr
378
; and 1 byte type of dialog to param
378
; and 1 byte type of dialog to param
379
    mov [param+5],byte 'S'   ;Get Open dialog (Use 'S' for Save dialog)
379
    mov [param+5],byte 'S'   ;Get Open dialog (Use 'S' for Save dialog)
380
 
380
 
381
;
381
;
382
; STEP2 prepare IPC area for get messages
382
; STEP2 prepare IPC area for get messages
383
;
383
;
384
 
384
 
385
; prepare IPC area
385
; prepare IPC area
386
    mov [path],dword 0
386
    mov [path],dword 0
387
    mov [path+4],dword 8
387
    mov [path+4],dword 8
388
 
388
 
389
; define IPC memory
389
; define IPC memory
390
    mov eax,60
390
    mov eax,60
391
    mov ebx,1        ; define IPC
391
    mov ebx,1        ; define IPC
392
    mov ecx,path ; offset of area
392
    mov ecx,path ; offset of area
393
    mov edx,120      ; size 150 bytes
393
    mov edx,120      ; size 150 bytes
394
    mcall
394
    mcall
395
 
395
 
396
; change wanted events list 7-bit IPC event
396
; change wanted events list 7-bit IPC event
397
    mov eax,40
397
    mov eax,40
398
    mov ebx,01000111b
398
    mov ebx,01000111b
399
    mcall
399
    mcall
400
 
400
 
401
;
401
;
402
; STEP 3 run SYSTEM XTREE with parameters
402
; STEP 3 run SYSTEM XTREE with parameters
403
;
403
;
404
 
404
 
405
    mov eax,58
405
    mov eax,58
406
    mov ebx,run_fileinfo
406
    mov ebx,run_fileinfo
407
    mcall
407
    mcall
408
 
408
 
409
    call redproc
409
    call redproc
410
 
410
 
411
    mov [get_loops],0
411
    mov [get_loops],0
412
getmesloop:
412
getmesloop:
413
    mov eax,23
413
    mov eax,23
414
    mov ebx,50     ;0.5 sec
414
    mov ebx,50     ;0.5 sec
415
    mcall
415
    mcall
416
 
416
 
417
    cmp eax,1
417
    cmp eax,1
418
    je  mred
418
    je  mred
419
    cmp eax,2
419
    cmp eax,2
420
    je  mkey
420
    je  mkey
421
    cmp eax,3
421
    cmp eax,3
422
    je  mbutton
422
    je  mbutton
423
    cmp eax,7
423
    cmp eax,7
424
    je  mgetmes
424
    je  mgetmes
425
 
425
 
426
; Get number of procces
426
; Get number of procces
427
    mov ebx,procinfo
427
    mov ebx,procinfo
428
    mov ecx,-1
428
    mov ecx,-1
429
    mov eax,9
429
    mov eax,9
430
    mcall
430
    mcall
431
    mov ebp,eax
431
    mov ebp,eax
432
 
432
 
433
loox:
433
loox:
434
    mov eax,9
434
    mov eax,9
435
    mov ebx,procinfo
435
    mov ebx,procinfo
436
    mov ecx,ebp
436
    mov ecx,ebp
437
    mcall
437
    mcall
438
    mov eax,[DLGPID]
438
    mov eax,[DLGPID]
439
    cmp [procinfo+30],eax    ;IF Dialog find
439
    cmp [procinfo+30],eax    ;IF Dialog find
440
    je  dlg_is_work          ;jmp to dlg_is_work
440
    je  dlg_is_work          ;jmp to dlg_is_work
441
    dec ebp
441
    dec ebp
442
    jnz loox
442
    jnz loox
443
 
443
 
444
    jmp erroff
444
    jmp erroff
445
 
445
 
446
dlg_is_work:
446
dlg_is_work:
447
    cmp [procinfo+50],word 9 ;If slot state 9 - dialog is terminated
447
    cmp [procinfo+50],word 9 ;If slot state 9 - dialog is terminated
448
    je  erroff                 ;TESTODP2 terminated too
448
    je  erroff                 ;TESTODP2 terminated too
449
 
449
 
450
    cmp [dlg_pid_get],dword 1
450
    cmp [dlg_pid_get],dword 1
451
    je  getmesloop
451
    je  getmesloop
452
    inc [get_loops]
452
    inc [get_loops]
453
    cmp [get_loops],4  ;2 sec if DLG_PID not get, TESTOP2  terminated
453
    cmp [get_loops],4  ;2 sec if DLG_PID not get, TESTOP2  terminated
454
    jae erroff
454
    jae erroff
455
    jmp getmesloop
455
    jmp getmesloop
456
 
456
 
457
mred:
457
mred:
458
    call redproc
458
    call redproc
459
    jmp  getmesloop
459
    jmp  getmesloop
460
mkey:
460
mkey:
461
    mcall                   ; read (eax=2)
461
    mcall                   ; read (eax=2)
462
    jmp  getmesloop
462
    jmp  getmesloop
463
mbutton:
463
mbutton:
464
    mov  eax,17                 ; get id
464
    mov  eax,17                 ; get id
465
    mcall
465
    mcall
466
    cmp  ah,1                   ; button id=1 ?
466
    cmp  ah,1                   ; button id=1 ?
467
    jne  getmesloop
467
    jne  getmesloop
468
    mov  eax,-1                 ; close this program
468
    mov  eax,-1                 ; close this program
469
    mcall
469
    mcall
470
mgetmes:
470
mgetmes:
471
 
471
 
472
; If dlg_pid_get then second message get jmp to still
472
; If dlg_pid_get then second message get jmp to still
473
    cmp  [dlg_pid_get],dword 1
473
    cmp  [dlg_pid_get],dword 1
474
    je   ready
474
    je   ready
475
 
475
 
476
; First message is number of PID SYSXTREE dialog
476
; First message is number of PID SYSXTREE dialog
477
 
477
 
478
; convert PID dec to PID bin
478
; convert PID dec to PID bin
479
    movzx eax,byte [path+16]
479
    movzx eax,byte [path+16]
480
    sub eax,48
480
    sub eax,48
481
    imul eax,10
481
    imul eax,10
482
    movzx ebx,byte [path+16+1]
482
    movzx ebx,byte [path+16+1]
483
    add eax,ebx
483
    add eax,ebx
484
    sub eax,48
484
    sub eax,48
485
    imul eax,10
485
    imul eax,10
486
    movzx ebx,byte [path+16+2]
486
    movzx ebx,byte [path+16+2]
487
    add eax,ebx
487
    add eax,ebx
488
    sub eax,48
488
    sub eax,48
489
    imul eax,10
489
    imul eax,10
490
    movzx ebx,byte [path+16+3]
490
    movzx ebx,byte [path+16+3]
491
    add eax,ebx
491
    add eax,ebx
492
    sub eax,48
492
    sub eax,48
493
    mov [DLGPID],eax
493
    mov [DLGPID],eax
494
 
494
 
495
; Claear and prepare IPC area for next message
495
; Claear and prepare IPC area for next message
496
    mov [path],dword 0
496
    mov [path],dword 0
497
    mov [path+4],dword 8
497
    mov [path+4],dword 8
498
    mov [path+8],dword 0
498
    mov [path+8],dword 0
499
    mov [path+12],dword 0
499
    mov [path+12],dword 0
500
    mov [path+16],dword 0
500
    mov [path+16],dword 0
501
 
501
 
502
; Set dlg_pid_get for get next message
502
; Set dlg_pid_get for get next message
503
    mov [dlg_pid_get],dword 1
503
    mov [dlg_pid_get],dword 1
504
    call redproc   ;show DLG_PID
504
    call redproc   ;show DLG_PID
505
    jmp  getmesloop
505
    jmp  getmesloop
506
 
506
 
507
ready:
507
ready:
508
;
508
;
509
; The second message get
509
; The second message get
510
; Second message is 100 bytes path to SAVE/OPEN file
510
; Second message is 100 bytes path to SAVE/OPEN file
511
; shl path string on 16 bytes
511
; shl path string on 16 bytes
512
;
512
;
513
    cld
513
    cld
514
    mov esi,path+16
514
    mov esi,path+16
515
    mov edi,path
515
    mov edi,path
516
    mov ecx,200
516
    mov ecx,200
517
    rep movsb
517
    rep movsb
518
    mov [edi],byte 0
518
    mov [edi],byte 0
519
 
519
 
520
    jmp openoff
520
    jmp openoff
521
 
521
 
522
 
522
 
523
; DATA AREA
523
; DATA AREA
524
get_loops   dd 0
524
get_loops   dd 0
525
dlg_pid_get dd 0
525
dlg_pid_get dd 0
526
DLGPID      dd 0
526
DLGPID      dd 0
527
 
527
 
528
param:
528
param:
529
   rb 4  ; My dec PID
529
   rb 4  ; My dec PID
530
   rb 6  ; Type of dialog
530
   rb 6  ; Type of dialog
531
 
531
 
532
run_fileinfo:
532
run_fileinfo:
533
 dd 16
533
 dd 16
534
 dd 0
534
 dd 0
535
 dd param
535
 dd param
536
 dd 0
536
 dd 0
537
 dd procinfo
537
 dd procinfo
538
run_filepath:
538
run_filepath:
539
 db '/RD/1/SYSXTREE',0
539
 db '/sys/SYSXTREE',0
540
 
540
 
541
procinfo:
541
procinfo:
542
times 256 db 0
542
times 256 db 0
543
}
543
}
544
 
544
 
545
 
545
 
546
 
546
 
547
 
547
 
548
; RANDOM - generate random count (small)
548
; RANDOM - generate random count (small)
549
; (SYNTAX)  RANDOM MaxCount,OutArgument
549
; (SYNTAX)  RANDOM MaxCount,OutArgument
550
; (SAMPLE)  RANDOM 10000,eax
550
; (SAMPLE)  RANDOM 10000,eax
551
; ( NOTE )  Maxint<65536 ; use random 65536,eax for more combinations
551
; ( NOTE )  Maxint<65536 ; use random 65536,eax for more combinations
552
 
552
 
553
randomuse = 0
553
randomuse = 0
554
 
554
 
555
macro random arg1,arg2
555
macro random arg1,arg2
556
{
556
{
557
local rxproc
557
local rxproc
558
randomuse = randomuse + 1
558
randomuse = randomuse + 1
559
 
559
 
560
      jmp rxproc
560
      jmp rxproc
561
 
561
 
562
if defined randomuse & randomuse = 1
562
if defined randomuse & randomuse = 1
563
randomproc:
563
randomproc:
564
      jmp rnj
564
      jmp rnj
565
rsx1 dw 0x4321
565
rsx1 dw 0x4321
566
rsx2 dw 0x1234
566
rsx2 dw 0x1234
567
rnj:
567
rnj:
568
;    mov eax,arg1
568
;    mov eax,arg1
569
    push bx
569
    push bx
570
    push cx
570
    push cx
571
    push dx
571
    push dx
572
    push si
572
    push si
573
    push di
573
    push di
574
    mov cx,ax
574
    mov cx,ax
575
    mov ax,word ptr rsx1
575
    mov ax,word ptr rsx1
576
    mov bx,word ptr rsx2
576
    mov bx,word ptr rsx2
577
    mov si,ax
577
    mov si,ax
578
    mov di,bx
578
    mov di,bx
579
    mov dl,ah
579
    mov dl,ah
580
    mov ah,al
580
    mov ah,al
581
    mov al,bh
581
    mov al,bh
582
    mov bh,bl
582
    mov bh,bl
583
    xor bl,bl
583
    xor bl,bl
584
    rcr dl,1
584
    rcr dl,1
585
    rcr ax,1
585
    rcr ax,1
586
    rcr bx,1
586
    rcr bx,1
587
    add bx,di
587
    add bx,di
588
    adc ax,si
588
    adc ax,si
589
    add bx,0x62e9
589
    add bx,0x62e9
590
    adc ax,0x3619
590
    adc ax,0x3619
591
    mov word ptr rsx1,bx
591
    mov word ptr rsx1,bx
592
    mov word ptr rsx2,ax
592
    mov word ptr rsx2,ax
593
    xor dx,dx
593
    xor dx,dx
594
    cmp ax,0
594
    cmp ax,0
595
    je nodiv
595
    je nodiv
596
    cmp cx,0
596
    cmp cx,0
597
    je nodiv
597
    je nodiv
598
    div cx
598
    div cx
599
nodiv:
599
nodiv:
600
    mov ax,dx
600
    mov ax,dx
601
    pop di
601
    pop di
602
    pop si
602
    pop si
603
    pop dx
603
    pop dx
604
    pop cx
604
    pop cx
605
    pop bx
605
    pop bx
606
    and eax,0000ffffh
606
    and eax,0000ffffh
607
;    mov arg2,0
607
;    mov arg2,0
608
;    mov arg2,eax
608
;    mov arg2,eax
609
    ret
609
    ret
610
end if
610
end if
611
 
611
 
612
rxproc:
612
rxproc:
613
    mov eax,arg1
613
    mov eax,arg1
614
    call randomproc
614
    call randomproc
615
    mov arg2,eax
615
    mov arg2,eax
616
}
616
}
617
 
617
 
618
macro scank
618
macro scank
619
{
619
{
620
    mov eax,10
620
    mov eax,10
621
    mcall
621
    mcall
622
}
622
}
623
 
623
 
624
macro putpix x,y,color
624
macro putpix x,y,color
625
{
625
{
626
    mov ebx,x
626
    mov ebx,x
627
    mov ecx,y
627
    mov ecx,y
628
    mov edx,color
628
    mov edx,color
629
    mov eax,1
629
    mov eax,1
630
    mcall
630
    mcall
631
}
631
}
632
 
632
 
633
macro puttxt x,y,offs,size,color
633
macro puttxt x,y,offs,size,color
634
{
634
{
635
;    mov ebx,x
635
;    mov ebx,x
636
;    shl ebx,16
636
;    shl ebx,16
637
;    add ebx,y
637
;    add ebx,y
638
    wordstoreg ebx,x,y
638
    wordstoreg ebx,x,y
639
    mov ecx,color
639
    mov ecx,color
640
    mov edx,offs
640
    mov edx,offs
641
    mov esi,size
641
    mov esi,size
642
    mov eax,4
642
    mov eax,4
643
    mcall
643
    mcall
644
}
644
}
645
 
645
 
646
macro outcount data, x, y, color, numtype
646
macro outcount data, x, y, color, numtype
647
{
647
{
648
    mov ecx,data
648
    mov ecx,data
649
    mov ebx,numtype
649
    mov ebx,numtype
650
    mov bl,0
650
    mov bl,0
651
;    mov edx,x*65536+y
651
;    mov edx,x*65536+y
652
    wordstoreg edx,x,y
652
    wordstoreg edx,x,y
653
    mov esi,color
653
    mov esi,color
654
    mov eax,47
654
    mov eax,47
655
    mcall
655
    mcall
656
}
656
}
657
 
657
 
658
; SCEVENT - Scan event
658
; SCEVENT - Scan event
659
 
659
 
660
macro scevent red,key,but
660
macro scevent red,key,but
661
{
661
{
662
    mov eax,11
662
    mov eax,11
663
    mcall
663
    mcall
664
    dec eax
664
    dec eax
665
    jz  red
665
    jz  red
666
    dec eax
666
    dec eax
667
    jz  key
667
    jz  key
668
    dec eax
668
    dec eax
669
    jz  but
669
    jz  but
670
}
670
}
671
 
671
 
672
; WTEVENT - Wait event
672
; WTEVENT - Wait event
673
 
673
 
674
macro wtevent red,key,but
674
macro wtevent red,key,but
675
{
675
{
676
    mov eax,10
676
    mov eax,10
677
    mcall
677
    mcall
678
    dec eax
678
    dec eax
679
    jz  red
679
    jz  red
680
    dec eax
680
    dec eax
681
    jz  key
681
    jz  key
682
    dec eax
682
    dec eax
683
    jz  but
683
    jz  but
684
}
684
}
685
 
685
 
686
; TIMEEVENT - Wite for event with timeout
686
; TIMEEVENT - Wite for event with timeout
687
 
687
 
688
macro timeevent xfps,noevent,red,key,but
688
macro timeevent xfps,noevent,red,key,but
689
{
689
{
690
    mov eax,23
690
    mov eax,23
691
    mov ebx,xfps
691
    mov ebx,xfps
692
    mcall
692
    mcall
693
    cmp eax,0
693
    cmp eax,0
694
    je  noevent
694
    je  noevent
695
    dec eax
695
    dec eax
696
    jz  red
696
    jz  red
697
    dec eax
697
    dec eax
698
    jz  key
698
    jz  key
699
    dec eax
699
    dec eax
700
    jz  but
700
    jz  but
701
}
701
}
702
 
702
 
703
 
703
 
704
; CLOSE - Close program
704
; CLOSE - Close program
705
 
705
 
706
macro close
706
macro close
707
{
707
{
708
    mov eax,-1
708
    mov eax,-1
709
    mcall
709
    mcall
710
}
710
}
711
 
711
 
712
; DELAY - Create delay 1/100 sec
712
; DELAY - Create delay 1/100 sec
713
; (SYNTAX)  Delay time
713
; (SYNTAX)  Delay time
714
; (SAMPLE)  Delay 100   ;delay 2 sec 1/100*200=2 sec
714
; (SAMPLE)  Delay 100   ;delay 2 sec 1/100*200=2 sec
715
 
715
 
716
macro delay arg1
716
macro delay arg1
717
{
717
{
718
    mov eax,5
718
    mov eax,5
719
    mov ebx,arg1
719
    mov ebx,arg1
720
    mcall
720
    mcall
721
}
721
}
722
 
722
 
723
; WINDOW - Draw window
723
; WINDOW - Draw window
724
; (SYNTAX)  WINDOW Xstart,Ystart,'Text',Color
724
; (SYNTAX)  WINDOW Xstart,Ystart,'Text',Color
725
; (SAMPLE)  WINDOW 10,10,640+8,480+24,window_Skinned
725
; (SAMPLE)  WINDOW 10,10,640+8,480+24,window_Skinned
726
 
726
 
727
macro window arg1,arg2,arg3,arg4,arg5
727
macro window arg1,arg2,arg3,arg4,arg5
728
{
728
{
729
;    mov ebx,arg1*65536+arg3
729
;    mov ebx,arg1*65536+arg3
730
;    mov ecx,arg2*65536+arg4
730
;    mov ecx,arg2*65536+arg4
731
    wordstoreg ebx,arg1,arg3
731
    wordstoreg ebx,arg1,arg3
732
    wordstoreg ecx,arg2,arg4
732
    wordstoreg ecx,arg2,arg4
733
    mov edx,arg5
733
    mov edx,arg5
734
    mov eax,0
734
    mov eax,0
735
    mcall
735
    mcall
736
}
736
}
737
 
737
 
738
macro colorwindow arg1,arg2,arg3,arg4,arg5,arg6,arg7
738
macro colorwindow arg1,arg2,arg3,arg4,arg5,arg6,arg7
739
{
739
{
740
    mov ebx,arg1*65536+arg3
740
    mov ebx,arg1*65536+arg3
741
    mov ecx,arg2*65536+arg4
741
    mov ecx,arg2*65536+arg4
742
    mov edx,arg5
742
    mov edx,arg5
743
    mov esi,arg6
743
    mov esi,arg6
744
    mov edi,arg7
744
    mov edi,arg7
745
    mov eax,0
745
    mov eax,0
746
    mcall
746
    mcall
747
}
747
}
748
 
748
 
749
 
749
 
750
; STARTWD - Start of window draw
750
; STARTWD - Start of window draw
751
 
751
 
752
macro startwd
752
macro startwd
753
{
753
{
754
    mov eax,12
754
    mov eax,12
755
    mov ebx,1
755
    mov ebx,1
756
    mcall
756
    mcall
757
}
757
}
758
 
758
 
759
; ENDWD - End window draw
759
; ENDWD - End window draw
760
 
760
 
761
macro endwd
761
macro endwd
762
{
762
{
763
    mov eax,12
763
    mov eax,12
764
    mov ebx,2
764
    mov ebx,2
765
    mcall
765
    mcall
766
}
766
}
767
 
767
 
768
; LABEL - Put text to frame
768
; LABEL - Put text to frame
769
; (SYNTAX)  LABEL Xstart,Ystart,'Text',Color
769
; (SYNTAX)  LABEL Xstart,Ystart,'Text',Color
770
; (SAMPLE)  LABEL 10,12,'Hello World!',cl_Green+font_Big
770
; (SAMPLE)  LABEL 10,12,'Hello World!',cl_Green+font_Big
771
 
771
 
772
macro label arg1,arg2,arg3,arg4
772
macro label arg1,arg2,arg3,arg4
773
{
773
{
774
local asd,lab
774
local asd,lab
775
    jmp asd
775
    jmp asd
776
lab db  arg3                 ;arg label
776
lab db  arg3                 ;arg label
777
asd:
777
asd:
778
;    mov ebx,arg1             ;arg1=y arg2=x
778
;    mov ebx,arg1             ;arg1=y arg2=x
779
;    shl ebx,16
779
;    shl ebx,16
780
;    add ebx,arg2
780
;    add ebx,arg2
781
    wordstoreg ebx,arg1,arg2
781
    wordstoreg ebx,arg1,arg2
782
if ~(arg4 eq )
782
if ~(arg4 eq )
783
    mov ecx,arg4             ;arg4 color
783
    mov ecx,arg4             ;arg4 color
784
end if
784
end if
785
    mov edx,lab
785
    mov edx,lab
786
    mov esi,asd-lab          ;calc size
786
    mov esi,asd-lab          ;calc size
787
    mov eax,4
787
    mov eax,4
788
    mcall
788
    mcall
789
}
789
}
790
 
790
 
791
;Key's
791
;Key's
792
key_Up     equ 178
792
key_Up     equ 178
793
key_Down   equ 177
793
key_Down   equ 177
794
key_Right  equ 179
794
key_Right  equ 179
795
key_Left   equ 176
795
key_Left   equ 176
796
key_Esc    equ 27
796
key_Esc    equ 27
797
key_Space  equ 32
797
key_Space  equ 32
798
key_Enter  equ 13
798
key_Enter  equ 13
799
key_Bspace equ 8
799
key_Bspace equ 8
800
key_F1     equ 50
800
key_F1     equ 50
801
key_F2     equ 51
801
key_F2     equ 51
802
key_F3     equ 52
802
key_F3     equ 52
803
key_F4     equ 53
803
key_F4     equ 53
804
key_F5     equ 54
804
key_F5     equ 54
805
key_F6     equ 55
805
key_F6     equ 55
806
key_F7     equ 56
806
key_F7     equ 56
807
key_F8     equ 57
807
key_F8     equ 57
808
key_F9     equ 48
808
key_F9     equ 48
809
key_F10    equ 49
809
key_F10    equ 49
810
key_F11    equ 68
810
key_F11    equ 68
811
key_F12    equ 255
811
key_F12    equ 255
812
key_Home   equ 180
812
key_Home   equ 180
813
key_End    equ 181
813
key_End    equ 181
814
key_PgUp   equ 184
814
key_PgUp   equ 184
815
key_PgDown equ 183
815
key_PgDown equ 183
816
 
816
 
817
;Attributes
817
;Attributes
818
 
818
 
819
;Window Attributes
819
;Window Attributes
820
window_Skinned equ 0x03000000
820
window_Skinned equ 0x03000000
821
window_Type2   equ 0x02000000
821
window_Type2   equ 0x02000000
822
window_Type1   equ 0x00000000
822
window_Type1   equ 0x00000000
823
window_Reserve equ 0x01000000
823
window_Reserve equ 0x01000000
824
 
824
 
825
;Font Attributes
825
;Font Attributes
826
font_Big  equ 0x10000000
826
font_Big  equ 0x10000000
827
 
827
 
828
;Colors
828
;Colors
829
cl_White  equ 0x00ffffff
829
cl_White  equ 0x00ffffff
830
cl_Black  equ 0x00000000
830
cl_Black  equ 0x00000000
831
cl_Grey   equ 0x00888888
831
cl_Grey   equ 0x00888888
832
cl_Red    equ 0x00ff0000
832
cl_Red    equ 0x00ff0000
833
cl_Lime   equ 0x0000ff00
833
cl_Lime   equ 0x0000ff00
834
cl_Green  equ 0x0000af00
834
cl_Green  equ 0x0000af00
835
cl_Blue   equ 0x000000ff
835
cl_Blue   equ 0x000000ff
836
cl_Purple equ 0x008080ff
836
cl_Purple equ 0x008080ff
837
cl_Violet equ 0x008040ff
837
cl_Violet equ 0x008040ff
838
cl_Cyan   equ 0x0040e0ff
838
cl_Cyan   equ 0x0040e0ff