Rev 3835 | Rev 4717 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
123 | diamond | 1 | ;--------------------------------------------------------------------- |
2 | ; |
||
2698 | leency | 3 | ; DOCPAK FOR KOLIBRI v1.2 |
123 | diamond | 4 | ; Written in pure assembly by Ivushkin Andrey aka Willow |
5 | ; |
||
6 | ;--------------------------------------------------------------------- |
||
7 | |||
8 | FILE_COUNT=0 |
||
9 | DEF_FILE equ 'g' |
||
10 | |||
11 | macro embed_file fn |
||
12 | { |
||
13 | forward |
||
14 | local label,label2,label3 |
||
15 | dd label2-label |
||
16 | dd label-label3 |
||
17 | label3: |
||
18 | db fn |
||
19 | label: |
||
1735 | clevermous | 20 | file '%DOCDIR%' # fn |
123 | diamond | 21 | label2: |
22 | FILE_COUNT=FILE_COUNT+1 |
||
23 | } |
||
2698 | leency | 24 | |
123 | diamond | 25 | use32 |
26 | org 0x0 |
||
27 | db 'MENUET01' ; 8 byte id |
||
28 | dd 0x01 ; header version |
||
29 | dd start ; start of code |
||
30 | dd I_END ; size of image |
||
31 | dd I_END+0x400 ; memory for app |
||
32 | dd I_END+0x400 ; esp |
||
33 | dd my_param , 0x0 ; I_Param , I_Icon |
||
1741 | dunkaist | 34 | include '../../../macros.inc' |
1736 | clevermous | 35 | include 'lang.inc' |
123 | diamond | 36 | |
37 | start: |
||
38 | cmp [my_param],0 |
||
39 | je red |
||
40 | cmp [my_param],'a' |
||
41 | jb .par_a |
||
42 | cmp [my_param],'z' |
||
43 | jbe .ok2 |
||
4716 | izikiel | 44 | .par_a: |
123 | diamond | 45 | mov [my_param],DEF_FILE |
46 | .ok2: |
||
47 | movzx ecx,[my_param] |
||
48 | mov [my_param],'*' |
||
49 | .open: |
||
50 | sub ecx,'a'-1 |
||
51 | mov edx,embedded |
||
52 | xor esi,esi |
||
4716 | izikiel | 53 | .list: |
123 | diamond | 54 | lea edx,[edx+esi+8] |
55 | mov esi,[edx-8] |
||
56 | add edx,[edx-4] |
||
57 | test esi,esi |
||
58 | jz .close |
||
59 | loop .list |
||
60 | push edx |
||
61 | ; convert number in esi to decimal representation |
||
62 | mov ecx, 10 |
||
63 | push -'0' |
||
64 | mov eax, esi |
||
65 | @@: |
||
66 | xor edx, edx |
||
67 | div ecx |
||
68 | push edx |
||
69 | test eax, eax |
||
70 | jnz @b |
||
71 | mov edi, fsize |
||
72 | @@: |
||
73 | pop eax |
||
74 | add al, '0' |
||
75 | stosb |
||
76 | jnz @b |
||
77 | mcall 70,fileinfo |
||
78 | mov ecx,eax |
||
79 | mcall 5,20 |
||
80 | pop edx |
||
81 | mcall 60,2 |
||
82 | cmp [my_param],'*' |
||
83 | jne still |
||
4716 | izikiel | 84 | .close: |
123 | diamond | 85 | mcall -1 |
86 | |||
87 | red: |
||
88 | mov [my_param],'a' |
||
4716 | izikiel | 89 | |
2698 | leency | 90 | mcall 48, 3, sc, sizeof.system_colors |
180 | heavyiron | 91 | |
123 | diamond | 92 | mcall 12,1 |
4716 | izikiel | 93 | |
180 | heavyiron | 94 | mov edx,[sc.work] |
551 | spraid | 95 | or edx,0x34000000 |
2698 | leency | 96 | mcall 0, <220,120>, <30,FILECOUNT*16+35>, , ,title |
180 | heavyiron | 97 | |
123 | diamond | 98 | mov ecx,FILECOUNT |
180 | heavyiron | 99 | mov ebx,5 shl 16+100 |
100 | mov esi,[sc.work_button] |
||
101 | mov edi,5 shl 16+14 |
||
123 | diamond | 102 | mov edx,10 |
103 | mov eax,8 |
||
104 | .btnlp: |
||
105 | push ecx |
||
106 | mcall ,,edi |
||
107 | add edi,16 shl 16 |
||
108 | inc edx |
||
109 | pop ecx |
||
110 | loop .btnlp |
||
111 | mov ecx,FILECOUNT |
||
112 | mov edx,embedded |
||
113 | xor edi,edi |
||
180 | heavyiron | 114 | mov ebx,25 shl 16+8 |
123 | diamond | 115 | mov eax,4 |
4716 | izikiel | 116 | .list: |
123 | diamond | 117 | lea edx,[edx+edi+8] |
118 | mov edi,[edx-8] |
||
119 | pusha |
||
120 | sub ebx,15 shl 16 |
||
180 | heavyiron | 121 | mcall ,,0xff0000,my_param,1 |
123 | diamond | 122 | inc [my_param] |
123 | popa |
||
124 | push ecx |
||
4716 | izikiel | 125 | mov esi, [edx-4] |
126 | sub esi, 4 ;remove .txt extension |
||
127 | mcall ,,[sc.work_button_text] |
||
123 | diamond | 128 | pop ecx |
129 | add edx,esi |
||
130 | add ebx,16 |
||
131 | loop .list |
||
132 | mcall 12,2 |
||
133 | |||
134 | still: |
||
135 | mcall 10 |
||
136 | cmp eax,1 |
||
137 | je red |
||
138 | cmp eax,2 |
||
139 | jne .nokey |
||
140 | mcall 2 |
||
141 | cmp ah,27 ;Esc |
||
142 | je start.close |
||
143 | cmp ah,'a' |
||
144 | jb still |
||
145 | cmp ah,'a'+FILECOUNT |
||
146 | jae still |
||
147 | jmp .cxax |
||
148 | .nokey: |
||
149 | mcall 17 |
||
150 | cmp ah,1 |
||
151 | je start.close |
||
152 | sub ah,10-'a' |
||
153 | .cxax: |
||
154 | movzx ecx,ah |
||
155 | jmp start.open |
||
156 | |||
157 | fileinfo: |
||
158 | dd 7 |
||
159 | dd 0 |
||
160 | dd param |
||
180 | heavyiron | 161 | dd 0 ,0 |
539 | spraid | 162 | db '/sys/TINYPAD',0 |
123 | diamond | 163 | |
164 | param db '*' |
||
165 | fsize: |
||
166 | times 10 db '0' |
||
167 | db 0 |
||
168 | |||
4716 | izikiel | 169 | embedded: |
123 | diamond | 170 | |
171 | ; Please use only filenames w/o path! |
||
172 | |||
173 | ; -- Start of embedding area ------ |
||
2700 | mario79 | 174 | embed_file 'README.TXT' ;a |
1735 | clevermous | 175 | if lang eq ru |
2700 | mario79 | 176 | embed_file 'GNU.TXT' ;b |
1735 | clevermous | 177 | else |
2700 | mario79 | 178 | embed_file 'COPYING.TXT' ;b |
1735 | clevermous | 179 | end if |
2700 | mario79 | 180 | embed_file 'HOT_KEYS.TXT' ;c |
123 | diamond | 181 | embed_file 'FASM.TXT' ;d |
182 | embed_file 'MTDBG.TXT' ;e |
||
1735 | clevermous | 183 | if lang eq ru |
2700 | mario79 | 184 | embed_file 'SYSFUNCR.TXT' ;f |
1735 | clevermous | 185 | else |
2700 | mario79 | 186 | embed_file 'SYSFUNCS.TXT' ;f |
3835 | mario79 | 187 | end if |
2700 | mario79 | 188 | embed_file 'STACK.TXT' ;g |
189 | embed_file 'KFAR_KEYS.TXT' ;h |
||
190 | embed_file 'INI.TXT' ;i |
||
3835 | mario79 | 191 | embed_file 'OPENDIAL.TXT' ;j |
123 | diamond | 192 | ; -- End of embedding area ------- |
193 | |||
194 | dd 0 |
||
195 | FILECOUNT = FILE_COUNT |
||
196 | |||
197 | if ~ FILECOUNT>0 |
||
198 | error 'No embedded files' |
||
199 | end if |
||
200 | |||
201 | my_param db 0 |
||
202 | rb 256 |
||
203 | I_END: |
||
180 | heavyiron | 204 | |
2698 | leency | 205 | title db 'Doc Pack',0 |
206 | |||
180 | heavyiron | 207 | sc system_colors30,FILECOUNT*16+35>220,120> |