Subversion Repositories Kolibri OS

Rev

Rev 4717 | Rev 6267 | 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
 
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
 
180 heavyiron 107
  mov  edx,[sc.work]
551 spraid 108
  or   edx,0x34000000
2698 leency 109
  mcall 0, <220,120>, <30,FILECOUNT*16+35>, , ,title
180 heavyiron 110
 
123 diamond 111
  mov   ecx,FILECOUNT
180 heavyiron 112
  mov   ebx,5 shl 16+100
113
  mov   esi,[sc.work_button]
114
  mov   edi,5 shl 16+14
123 diamond 115
  mov   edx,10
116
  mov   eax,8
117
 .btnlp:
118
  push  ecx
119
  mcall ,,edi
120
  add   edi,16 shl 16
121
  inc   edx
122
  pop   ecx
123
  loop  .btnlp
124
  mov   ecx,FILECOUNT
125
  mov   edx,embedded
126
  xor   edi,edi
180 heavyiron 127
  mov   ebx,25 shl 16+8
123 diamond 128
  mov   eax,4
4716 izikiel 129
 .list:
123 diamond 130
  lea   edx,[edx+edi+8]
131
  mov   edi,[edx-8]
132
  pusha
133
  sub   ebx,15 shl 16
180 heavyiron 134
  mcall ,,0xff0000,my_param,1
123 diamond 135
  inc   [my_param]
136
  popa
137
  push  ecx
4716 izikiel 138
  mov esi, [edx-4]
139
  sub esi, 4 ;remove .txt extension
140
  mcall ,,[sc.work_button_text]
123 diamond 141
  pop   ecx
4717 izikiel 142
  add   esi, 4
143
  add   edx, esi
123 diamond 144
  add   ebx,16
145
  loop  .list
146
  mcall 12,2
147
 
148
still:
149
  mcall 10
150
  cmp   eax,1
151
  je    red
152
  cmp   eax,2
153
  jne   .nokey
154
  mcall 2
155
  cmp   ah,27 ;Esc
156
  je    start.close
157
  cmp   ah,'a'
158
  jb    still
159
  cmp   ah,'a'+FILECOUNT
160
  jae   still
161
  jmp   .cxax
162
 .nokey:
163
  mcall 17
164
  cmp   ah,1
165
  je    start.close
166
  sub   ah,10-'a'
167
 .cxax:
168
  movzx  ecx,ah
169
  jmp   start.open
170
 
171
fileinfo:
172
        dd      7
173
        dd      0
174
        dd      param
180 heavyiron 175
        dd      0 ,0
539 spraid 176
        db      '/sys/TINYPAD',0
123 diamond 177
 
178
param  db '*'
179
fsize:
180
       times 10 db '0'
181
       db 0
182
 
4716 izikiel 183
embedded:
123 diamond 184
 
185
; Please use only filenames w/o path!
186
 
187
; -- Start of embedding area ------
5098 clevermous 188
  embed_docdir_file 'README.TXT'       ;a
1735 clevermous 189
if lang eq ru
5098 clevermous 190
  embed_docdir_file 'GNU.TXT'          ;b
1735 clevermous 191
else
5098 clevermous 192
  embed_docdir_file 'COPYING.TXT'      ;b
1735 clevermous 193
end if
5098 clevermous 194
  embed_docdir_file 'HOT_KEYS.TXT'     ;c
195
  embed_local_file 'FASM.TXT'          ;d
196
  embed_docdir_file 'MTDBG.TXT'        ;e
1735 clevermous 197
if lang eq ru
5098 clevermous 198
  embed_local_file 'SYSFUNCR.TXT'      ;f
1735 clevermous 199
else
5098 clevermous 200
  embed_local_file 'SYSFUNCS.TXT'      ;f
3835 mario79 201
end if
5098 clevermous 202
  embed_docdir_file 'STACK.TXT'        ;g
203
  embed_docdir_file 'KFAR_KEYS.TXT'    ;h
204
  embed_docdir_file 'INI.TXT'          ;i
205
  embed_docdir_file 'OPENDIAL.TXT'     ;j
123 diamond 206
; -- End of embedding area  -------
207
 
208
  dd 0
209
FILECOUNT = FILE_COUNT
210
 
211
  if ~ FILECOUNT>0
212
    error 'No embedded files'
213
  end if
214
 
215
my_param db 0
216
  rb 256
217
I_END:
180 heavyiron 218
 
2698 leency 219
title db 'Doc Pack',0
220
 
180 heavyiron 221
sc     system_colors