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