Rev 485 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
31 | halyavin | 1 | lang equ ru ; ru en fr ge fi |
2 | |||
3 | ; |
||
4 | ; Assembler |
||
5 | ; SMALL |
||
6 | ; CODE |
||
7 | ; Libary |
||
8 | ; |
||
9 | ; Ver 0.14 By Pavlushin Evgeni (RUSSIA) |
||
10 | ; www.waptap@mail.ru |
||
11 | |||
12 | ;Please compile aplications on FASM ver1.54 or higer!!! |
||
13 | |||
14 | ;InfoList |
||
15 | ;0.01 scank,putpix,puttxt |
||
16 | ;0.02 label,random,colors |
||
17 | ;0.03 window,startwd,endwd,attributes |
||
18 | ;0.04 close,delay,scevent ~30.04.2004 |
||
19 | ;0.05 small random, ~04.05.2004 |
||
20 | ;0.06 wtevent ~09.05.2004 |
||
21 | ;0.07 timeevent ~23.05.2004 |
||
22 | ;0.08 txtput ~14.06.2004 |
||
23 | ;0.09 opendialog,savedialog ~20.06.2004 |
||
24 | ;0.10 wordstoreg by halyavin, add at ~30.08.2004 |
||
25 | ; random bug deleted eax is use. |
||
26 | ;0.11 loadfile from me +puttxt bug del ~07.09.2004 |
||
27 | ;0.12 open/save dialog ~13.09.2004 |
||
28 | ;0.13 dialogs bugs deleted |
||
29 | ;0.14 drawlbut ~03.10.2004 |
||
131 | diamond | 30 | ;0.15 extendet label! |
31 | halyavin | 31 | |
32 | ; LOADFILE |
||
33 | ; (SYNTAX) LOADFILE 'full_path_to_file',file_load_area,file_temp_area |
||
34 | ; (SAMPLE) LOADFILE '/rd/1/clock.bmp',load_area,temp_area |
||
35 | |||
131 | diamond | 36 | |
31 | halyavin | 37 | macro loadfile file_name,file_load_area,file_temp_area |
38 | { |
||
39 | local open,fileinfo,string |
||
40 | jmp open |
||
41 | fileinfo: |
||
42 | dd 0 |
||
43 | dd 0 |
||
44 | dd 1 |
||
45 | dd file_load_area |
||
46 | dd file_temp_area |
||
47 | string: |
||
48 | db file_name,0 |
||
49 | open: |
||
50 | mov dword [fileinfo+8],1 ; how many blocks to read (1) |
||
51 | mov eax,58 |
||
52 | mov ebx,fileinfo |
||
485 | heavyiron | 53 | mcall |
31 | halyavin | 54 | mov eax,[file_load_area+2] |
55 | shr eax,9 ; поделим на 512 и прибавим 1 - получим число блоков |
||
56 | inc eax |
||
57 | mov dword [fileinfo+8],eax |
||
58 | mov eax,58 |
||
59 | mov ebx,fileinfo |
||
485 | heavyiron | 60 | mcall |
31 | halyavin | 61 | } |
62 | |||
63 | |||
131 | diamond | 64 | ;macro wordstoreg reg,hiword,loword |
65 | ;{ |
||
66 | ;if hiword eqtype 0 & loword eqtype 0 |
||
67 | ; mov reg,dword hiword*65536+loword |
||
68 | ;else if hiword eqtype 12 & loword eqtype eax |
||
69 | ; mov reg,dword hiword*65536 |
||
70 | ; add reg,dword loword |
||
71 | ;else if hiword eqtype 12 & loword eqtype [123] |
||
72 | ; mov reg,dword hiword*65536 |
||
73 | ; add reg,dword loword |
||
74 | ;else |
||
75 | ; mov reg,dword hiword |
||
76 | ; shl reg,16 |
||
77 | ; add reg,dword loword |
||
78 | ;end if |
||
79 | ;} |
||
80 | |||
81 | macro dword2reg reg,doubleword |
||
31 | halyavin | 82 | { |
131 | diamond | 83 | if doubleword eq |
84 | ; not changes |
||
31 | halyavin | 85 | else |
131 | diamond | 86 | mov reg,dword doubleword |
31 | halyavin | 87 | end if |
88 | } |
||
89 | |||
131 | diamond | 90 | macro words2reg reg,hiword,lowword |
91 | { |
||
92 | if hiword eq |
||
93 | if lowword eq |
||
94 | ; not changes |
||
95 | else |
||
96 | if lowword eqtype 12 |
||
97 | and reg,dword 0xffff0000 |
||
98 | add reg,dword lowword |
||
99 | else |
||
100 | and reg,dword 0xffff0000 |
||
101 | add reg,dword lowword |
||
102 | end if |
||
103 | end if |
||
104 | else |
||
105 | if lowword eq |
||
106 | if hiword eqtype 12 |
||
107 | and reg,dword 0x0000ffff |
||
108 | add reg,dword hiword*65536 |
||
109 | else |
||
110 | shl reg,16 |
||
111 | add reg,dword hiword |
||
112 | ror reg,16 |
||
113 | end if |
||
114 | else |
||
115 | if lowword eqtype 12 & hiword eqtype 12 |
||
116 | if lowword eq 0 & hiword eq 0 |
||
117 | xor reg,reg |
||
118 | else |
||
119 | mov reg,dword hiword*65536+lowword |
||
120 | end if |
||
121 | else |
||
122 | mov reg,dword hiword |
||
123 | shl reg,16 |
||
124 | add reg,dword lowword |
||
125 | end if |
||
126 | end if |
||
127 | end if |
||
128 | } |
||
31 | halyavin | 129 | |
131 | diamond | 130 | |
131 | |||
132 | |||
31 | halyavin | 133 | ; DRAW BUTTON with label |
134 | |||
135 | macro drawlbut x,y,xs,ys,text,id,bcolor,tcolor |
||
136 | { |
||
137 | local asd,lab |
||
138 | jmp asd |
||
139 | lab db text ;arg label |
||
140 | asd: |
||
131 | diamond | 141 | words2reg ebx,x,xs |
142 | words2reg ecx,y,ys |
||
31 | halyavin | 143 | mov edx,id |
144 | mov esi,bcolor |
||
145 | mov eax,8 |
||
485 | heavyiron | 146 | mcall |
31 | halyavin | 147 | |
148 | mov eax,asd-lab ;calc size |
||
149 | mov ebx,6 |
||
150 | mul ebx |
||
151 | mov esi,eax |
||
152 | |||
153 | mov eax,xs |
||
154 | sub eax,esi |
||
155 | shr eax,1 |
||
156 | add eax,x |
||
157 | |||
158 | mov edx,ys |
||
159 | sub edx,7 |
||
160 | shr edx,1 |
||
161 | add edx,y |
||
162 | |||
163 | mov ebx,eax |
||
164 | shl ebx,16 |
||
165 | add ebx,edx |
||
166 | |||
167 | mov ecx,tcolor ;arg4 color |
||
168 | mov edx,lab |
||
169 | mov esi,asd-lab ;calc size |
||
170 | mov eax,4 |
||
485 | heavyiron | 171 | mcall |
31 | halyavin | 172 | } |
173 | |||
174 | |||
175 | macro opendialog redproc,openoff,erroff,path |
||
176 | { |
||
177 | local new_d, get_loops, dlg_pid_get, DLGPID, num_of_proc |
||
178 | local run_fileinfo, param |
||
179 | local getmesloop, loox, mred, mkey, mbutton, mgetmes |
||
180 | local dlg_is_work, ready, procinfo |
||
181 | ; |
||
182 | ; STEP 1 Run SYSXTREE with parametrs MYPID 4 bytes in dec, |
||
183 | ; 1 byte space, 1 byte type of dialog (O - Open ,S - Save) |
||
184 | ; |
||
185 | |||
186 | cld |
||
187 | ;; mov esi,path |
||
188 | mov edi,path |
||
134 | diamond | 189 | xor eax,eax |
190 | mov ecx,(1024+16)/4 |
||
191 | rep stosd |
||
31 | halyavin | 192 | |
193 | ;mov [get_loops],0 |
||
194 | mov [dlg_pid_get],0 |
||
195 | |||
196 | ; Get my PID in dec format 4 bytes |
||
197 | mov eax,9 |
||
198 | mov ebx,procinfo |
||
199 | mov ecx,-1 |
||
485 | heavyiron | 200 | mcall |
31 | halyavin | 201 | |
202 | ; convert eax bin to param dec |
||
203 | mov eax,dword [procinfo+30] ;offset of myPID |
||
204 | mov edi,param+4-1 ;offset to 4 bytes |
||
205 | mov ecx,4 |
||
206 | mov ebx,10 |
||
207 | cld |
||
208 | new_d: |
||
209 | xor edx,edx |
||
210 | div ebx |
||
211 | add dl,'0' |
||
212 | mov [edi],dl |
||
213 | dec edi |
||
214 | loop new_d |
||
215 | |||
216 | ; wirite 1 byte space to param |
||
217 | mov [param+4],byte 32 ;Space for next parametr |
||
218 | ; and 1 byte type of dialog to param |
||
219 | mov [param+5],byte 'O' ;Get Open dialog (Use 'S' for Save dialog) |
||
220 | |||
221 | ; |
||
222 | ; STEP2 prepare IPC area for get messages |
||
223 | ; |
||
224 | |||
225 | ; prepare IPC area |
||
226 | mov [path],dword 0 |
||
227 | mov [path+4],dword 8 |
||
228 | |||
229 | ; define IPC memory |
||
230 | mov eax,60 |
||
231 | mov ebx,1 ; define IPC |
||
232 | mov ecx,path ; offset of area |
||
134 | diamond | 233 | mov edx,1024+16 ; size |
485 | heavyiron | 234 | mcall |
31 | halyavin | 235 | |
236 | ; change wanted events list 7-bit IPC event |
||
237 | mov eax,40 |
||
238 | mov ebx,01000111b |
||
485 | heavyiron | 239 | mcall |
31 | halyavin | 240 | |
241 | ; |
||
242 | ; STEP 3 run SYSTEM XTREE with parameters |
||
243 | ; |
||
244 | |||
134 | diamond | 245 | mov eax,70 |
31 | halyavin | 246 | mov ebx,run_fileinfo |
485 | heavyiron | 247 | mcall |
31 | halyavin | 248 | |
249 | call redproc |
||
250 | |||