Subversion Repositories Kolibri OS

Rev

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