Subversion Repositories Kolibri OS

Rev

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

Rev Author Line No. Line
31 halyavin 1
;
2
;   Save Ramdisk to HD
3
;
4
;   Compile with FASM for Menuet
5
;
6
 
7
include 'lang.inc'
8
include 'macros.inc'
9
 
10
  use32
11
  org	 0x0
12
 
13
  db	 'MENUET01'		; 8 byte id
14
  dd	 0x01			; header version
15
  dd	 START			; start of code
16
  dd	 I_END			; size of image
17
  dd	 0x1000 		; memory for app
18
  dd	 0x1000 		; esp
19
  dd	 0x0 ; , 0x0            ; I_Param , I_Icon
20
 
21
 
22
;******************************************************************************
23
 
24
 
25
START:				; start of execution
26
    xor  eax,eax
27
    mov  edi,bootpath
28
    mov  ecx,128
29
    rep  stosd
30
 
31
    mcall 6,filename,0,-1,bootpath
32
 
33
    mov esi,bootpath+1
34
    mov cx,512
35
  start_search:
36
    lodsb
37
    cmp al,"'"
38
    jz	set_end_path
39
    dec cx
40
    cmp cx,0
41
    ja	start_search
42
  set_end_path:
43
    mov [esi-1],byte 0
44
 
45
    mov  eax,40
46
    mov  ebx,101b
47
    int  0x40
48
 
49
red:
50
    call draw_window
51
 
52
still:
53
    mov  eax, 10		 ; wait here for event
54
    int  0x40
55
 
56
    dec  eax		      ; redraw request ?
57
    je	 red
58
;    dec  eax
59
;    dec  eax                  ; button in buffer ?
60
;    je   button
61
 
62
 
63
  button:		       ; button
64
    mov  eax,17 	       ; get id
65
    int  0x40
66
    cmp  ah,2
67
    jne  ah_3
68
    mcall 18,6,1
69
    jmp  red
70
  ah_3:
71
    cmp  ah,3
72
    jne  ah_4
73
    mcall 18,6,2
74
    jmp  red
75
  ah_4:
76
    cmp  ah,4
77
    jne  ah_1
78
    mcall 18,6,3,bootpath+1
79
    jmp  red
80
  ah_1:
81
    cmp  ah,1
82
    je	 exit
83
    jmp  still
84
 
85
  exit:
86
    or	 eax,-1 		   ; close this program
87
    int  0x40
88
 
89
 
90
;   *********************************************
91
;   *******  WINDOW DEFINITIONS AND DRAW ********
92
;   *********************************************
93
 
94
draw_window:
95
 
96
    mov  eax, 12		; function 12:tell os about windowdraw
97
    mov  ebx, 1 		; 1, start of draw
98
    int  0x40
99
				; DRAW WINDOW
100
    mov  eax, 0 		; function 0 : define and draw window
101
    mov  ebx, 200*65536+220	; [x start] *65536 + [x size]
102
    mov  ecx, 200*65536+150	 ; [y start] *65536 + [y size]
103
    mov  edx, 0x03ccddee       ; color of work area RRGGBB,8->color gl
104
    int  0x40
105
				; WINDOW LABEL
106
    mov  eax, 4 		; function 4 : write text to window
107
    mov  ebx, 8*65536+8 	; [x start] *65536 + [y start]
108
    mov  ecx, 0x10ffffff	; font 1 & color ( 0xF0RRGGBB )
109
    mov  edx, header		; pointer to text beginning
110
    mov  esi, header.size	; text length
111
    int  0x40
112
 
113
    xor  edx,edx
114
    mcall 13,<15,20>,<30,20>
115
    mcall 13, ,<60,20>
116
    mcall 13, ,<90,20>
117
 
118
    mcall 8,<16,17>,<31,17>,2,0xdd7700
119
    inc  edx
120
    mcall 8, ,<61,17>, ,0xbb00
121
    inc  edx
122
    mcall 8, ,<91,17>, ,0xcc5555
123
 
124
    mcall 4,<22,36>,0x10ffffff,text_123,1
125
    add bx,30
126
    add edx,1
127
    mcall 4
128
    add bx,30
129
    add edx,1
130
    mcall 4
131
 
132
    mcall 4,<45,36>,0,text_1,text_1.size
133
    add  bx,30
134
    mcall 4, ,0,text_2,text_2.size
135
    add  bx,30
136
    mcall 4, ,0,text_3,text_3.size
137
    mcall 4,<20,120>,0,text_4,text_4.size
138
    mcall 4,<40,130>,0,text_5,text_5.size
139
 
140
    mcall 4,<40,46>,0,text_6,text_6.size
141
    mcall 4,<40,106>,0,text_6,text_6.size
142
 
143
    mov  eax,12 		; function 12:tell os about windowdraw
144
    mov  ebx,2			; 2, end of draw
145
    int  0x40
146
ret
147
 
148
 
149
 
150
 
151
sz  header, "RD2HD сохранить IMG>HD"
152
text_123 db '123'
153
sz text_1, 'В папку /KOLIBRI'
154
sz text_2, 'В корень диска'
155
sz text_3, 'Путь в файле RD2HD.TXT'
156
sz text_4, 'п.3 для резервного сохранения,'
157
sz text_5, 'т.к. в ядре его нет.'
158
sz text_6, '(папка должна присутствовать)'
159
filename db 'RD2HD   TXT'
160
I_END:
161
bootpath: