Rev 4716 | Rev 5098 | 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 |
4717 | izikiel | 129 | add esi, 4 |
130 | add edx, esi |
||
123 | diamond | 131 | add ebx,16 |
132 | loop .list |
||
133 | mcall 12,2 |
||
134 | |||
135 | still: |
||
136 | mcall 10 |
||
137 | cmp eax,1 |
||
138 | je red |
||
139 | cmp eax,2 |
||
140 | jne .nokey |
||
141 | mcall 2 |
||
142 | cmp ah,27 ;Esc |
||
143 | je start.close |
||
144 | cmp ah,'a' |
||
145 | jb still |
||
146 | cmp ah,'a'+FILECOUNT |
||
147 | jae still |
||
148 | jmp .cxax |
||
149 | .nokey: |
||
150 | mcall 17 |
||
151 | cmp ah,1 |
||
152 | je start.close |
||
153 | sub ah,10-'a' |
||
154 | .cxax: |
||
155 | movzx ecx,ah |
||
156 | jmp start.open |
||
157 | |||
158 | fileinfo: |
||
159 | dd 7 |
||
160 | dd 0 |
||
161 | dd param |
||
180 | heavyiron | 162 | dd 0 ,0 |
539 | spraid | 163 | db '/sys/TINYPAD',0 |
123 | diamond | 164 | |
165 | param db '*' |
||
166 | fsize: |
||
167 | times 10 db '0' |
||
168 | db 0 |
||
169 | |||
4716 | izikiel | 170 | embedded: |
123 | diamond | 171 | |
172 | ; Please use only filenames w/o path! |
||
173 | |||
174 | ; -- Start of embedding area ------ |
||
2700 | mario79 | 175 | embed_file 'README.TXT' ;a |
1735 | clevermous | 176 | if lang eq ru |
2700 | mario79 | 177 | embed_file 'GNU.TXT' ;b |
1735 | clevermous | 178 | else |
2700 | mario79 | 179 | embed_file 'COPYING.TXT' ;b |
1735 | clevermous | 180 | end if |
2700 | mario79 | 181 | embed_file 'HOT_KEYS.TXT' ;c |
123 | diamond | 182 | embed_file 'FASM.TXT' ;d |
183 | embed_file 'MTDBG.TXT' ;e |
||
1735 | clevermous | 184 | if lang eq ru |
2700 | mario79 | 185 | embed_file 'SYSFUNCR.TXT' ;f |
1735 | clevermous | 186 | else |
2700 | mario79 | 187 | embed_file 'SYSFUNCS.TXT' ;f |
3835 | mario79 | 188 | end if |
2700 | mario79 | 189 | embed_file 'STACK.TXT' ;g |
190 | embed_file 'KFAR_KEYS.TXT' ;h |
||
191 | embed_file 'INI.TXT' ;i |
||
3835 | mario79 | 192 | embed_file 'OPENDIAL.TXT' ;j |
123 | diamond | 193 | ; -- End of embedding area ------- |
194 | |||
195 | dd 0 |
||
196 | FILECOUNT = FILE_COUNT |
||
197 | |||
198 | if ~ FILECOUNT>0 |
||
199 | error 'No embedded files' |
||
200 | end if |
||
201 | |||
202 | my_param db 0 |
||
203 | rb 256 |
||
204 | I_END: |
||
180 | heavyiron | 205 | |
2698 | leency | 206 | title db 'Doc Pack',0 |
207 | |||
180 | heavyiron | 208 | sc system_colors30,FILECOUNT*16+35>220,120> |