Subversion Repositories Kolibri OS

Rev

Rev 341 | Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
205 heavyiron 1
;
2
;   Save Ramdisk to HD and FD
3
;   Mario79 2005
4
;   Compile with FASM for Menuet
5
;
6
 
7
include 'lang.inc'
8
include 'macros.inc'
9
 
10
appname equ 'RDsave '
11
version equ '1.1'
12
 
13
  use32
14
  org     0x0
15
 
16
  db     'MENUET01'     ; 8 byte id
17
  dd     0x01           ; header version
18
  dd     START          ; start of code
19
  dd     I_END          ; size of image
20
  dd     0x1000         ; memory for app
21
  dd     0x1000         ; esp
22
  dd     0x0 , 0x0      ; I_Param , I_Icon
23
 
24
 
25
;******************************************************************************
26
 
27
 
28
START:                ; start of execution
29
    xor  eax,eax
30
    mov  edi,bootpath
31
    mov  ecx,128
32
    rep  stosd
33
 
34
    mcall 6,filename,0,-1,bootpath
35
 
36
    mov esi,bootpath+1
37
    mov cx,512
38
  start_search:
39
    lodsb
40
    cmp al,"'"
41
    jz    set_end_path
42
    dec cx
43
    cmp cx,0
44
    ja    start_search
45
  set_end_path:
46
    mov [esi-1],byte 0
47
 
48
    mov  eax,40
49
    mov  ebx,101b
50
    int  0x40
51
 
52
red:
53
    call draw_window
54
 
55
still:
56
    mov  eax, 10         ; wait here for event
57
    int  0x40
58
 
59
    dec  eax              ; redraw request ?
60
    je     red
61
;    dec  eax
62
;    dec  eax                  ; button in buffer ?
63
;    je   button
64
 
65
 
66
  button:               ; button
67
    mov  eax,17            ; get id
68
    int  0x40
69
    cmp  ah,2
70
    jne  ah_3
71
    mcall 18,6,1
72
    jmp  red
73
  ah_3:
74
    cmp  ah,3
75
    jne  ah_4
76
    mcall 18,6,2
77
    jmp  red
78
  ah_4:
79
    cmp  ah,4
80
    jne  ah_5
81
    mcall 18,6,3,bootpath+1
82
    jmp  red
83
  ah_5:
84
    cmp  ah,5
85
    jne  ah_6
86
    mcall 16,1
87
    jmp  red
88
  ah_6:
89
    cmp  ah,6
90
    jne  ah_1
91
    mcall 16,2
92
    jmp  red
93
 
94
  ah_1:
95
    cmp  ah,1
96
    je     exit
97
    jmp  still
98
 
99
  exit:
100
    or     eax,-1            ; close this program
101
    int  0x40
102
 
103
 
104
;   *********************************************
105
;   *******  WINDOW DEFINITIONS AND DRAW ********
106
;   *********************************************
107
 
108
draw_window:
109
 
110
    mov  eax,48
111
    mov  ebx,3
112
    mov  ecx,sc
113
    mov  edx,sizeof.system_colors
114
    int  0x40
115
 
116
    mov  eax, 12                ; function 12:tell os about windowdraw
117
    mov  ebx, 1                 ; 1, start of draw
118
    int  0x40
119
                ; DRAW WINDOW
120
    mov  eax, 0                 ; function 0 : define and draw window
121
    mov  ebx, 200*65536+230     ; [x start] *65536 + [x size]
122
    mov  ecx, 200*65536+260     ; [y start] *65536 + [y size]
123
    mov  edx, [sc.work]         ; color of work area RRGGBB,8->color gl
124
    or   edx,0x33000000
125
    mov  edi,header             ; WINDOW LABEL
126
    int  0x40
127
 
128
    mcall 8,<11,17>,<26,17>,2,[sc.work_button]
129
    inc  edx
130
    mcall  , ,<56,17>, ,
131
    inc  edx
132
    mcall  , ,<86,17>, ,
133
    inc  edx
134
    mcall  , ,<166,17>, ,
135
    inc  edx
136
    mcall  , ,<196,17>, ,
137
 
138
    mov    ecx,[sc.work_button_text]
139
    or     ecx,0x10000000
140
    mcall 4,<17,31>, ,text_123,1
141
    add ebx,30
142
    add edx,1
143
    mcall
144
    add ebx,30
145
    add edx,1
146
    mcall
147
    add ebx,80
148
    add edx,1
149
    mcall
150
    add ebx,30
151
    add edx,1
152
    mcall
153
 
154
    mov    ecx,[sc.work_text]
155
    or     ecx,0x80000000
156
    mcall  ,<40,31>, ,text_1,
157
    add    ebx,30
158
    mcall  , , ,text_2,
159
    add    ebx,30
160
    mcall  , , ,text_3,
161
    mcall  ,<15,115>, ,text_4,
162
    mcall  ,<35,125>, ,text_5,
163
 
164
    mcall  ,<35,41>, ,text_6,
165
    mcall  ,<35,101>, ,text_6,
166
    mcall  ,<40,171>, ,text_7,
167
    mcall  ,<40,201>, ,text_8,
168
    mcall  ,<25,10>, ,text_9,
169
    mcall  ,<25,150>, ,text_10,
170
 
171
    mov  eax,12           ; function 12:tell os about windowdraw
172
    mov  ebx,2            ; 2, end of draw
173
    int  0x40
174
ret
175
 
176
 
177
header   db appname,version,0
178
 
179
text_123 db '12345'
180
 
181
if lang eq ru
182
 
183
text_1  db 'В папку С:\KOLIBRI',0
184
text_2  db 'В корень диска С',0
185
text_3  db 'Путь в файле RD2HD.TXT',0
186
text_4  db 'п.3 для резервного сохранения',0
187
text_5  db 'т.к. в ядре его нет.',0
188
text_6  db '(папка должна присутствовать)',0
189
text_7  db 'На /FD/1',0
190
text_8  db 'На /FD/2',0
191
text_9  db 'Сохранение на жесткий диск:',0
192
text_10 db 'Сохранение на дискету:',0
193
 
194
else
195
 
196
text_1  db 'To the folder C:\KOLIBRI',0
197
text_2  db 'To the root of C',0
198
text_3  db 'To path in the file RD2HD.TXT',0
199
text_4  db 'p.3 for backup, as the kernel',0
200
text_5  db 'can not boot from there.',0
201
text_6  db '(folder must exist)',0
202
text_7  db 'To /FD/1',0
203
text_8  db 'To /FD/2',0
204
text_9  db 'Save to hard disk:',0
205
text_10 db 'Save to floppy:',0
206
 
207
end if
208
 
209
filename db 'RD2HD   TXT'
210
I_END:
211
sc  system_colors
212
bootpath: