Subversion Repositories Kolibri OS

Rev

Rev 8236 | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 8236 Rev 9568
1
;;      h2d2b v0.5 big fonts by Leency      ;;
1
;;      h2d2b v0.5 big fonts by Leency      ;;
2
;;      09.11.2016                          ;;
2
;;      09.11.2016                          ;;
3
 
3
 
4
;;      h2d2b v0.4 use editbox by IgorA     ;;
4
;;      h2d2b v0.4 use editbox by IgorA     ;;
5
;;      30.08.2011                          ;;
5
;;      30.08.2011                          ;;
6
 
6
 
7
;;      h2d2b v0.3 system colors by Leency  ;;
7
;;      h2d2b v0.3 system colors by Leency  ;;
8
;;      21.08.2011                          ;;
8
;;      21.08.2011                          ;;
9
 
9
 
10
;;      hex2dec2bin 0.2 by Alexei Ershov    ;;
10
;;      hex2dec2bin 0.2 by Alexei Ershov    ;;
11
;;      16.11.2006                          ;;
11
;;      16.11.2006                          ;;
12
 
12
 
13
WIN_W = 364
13
WIN_W = 364
14
 
14
 
15
use32
15
use32
16
    org 0x0
16
    org 0
17
    db  'MENUET01'
17
    db  'MENUET01'
18
    dd  0x01,start,i_end,e_end,e_end,0,sys_path
18
    dd  1,start,i_end,e_end,e_end,0,sys_path
19
 
19
 
20
include '../../../proc32.inc'
20
include '../../../proc32.inc'
21
include '../../../macros.inc' ; ¬ ªà®áë ®¡«¥£ç îâ ¦¨§­ì  áᥬ¡«¥à騪®¢!
21
include '../../../macros.inc' ; ¬ ªà®áë ®¡«¥£ç îâ ¦¨§­ì  áᥬ¡«¥à騪®¢!
22
include '../../../KOSfuncs.inc'
22
include '../../../KOSfuncs.inc'
23
include '../../../load_lib.mac'
23
include '../../../load_lib.mac'
24
include '../../../develop/libraries/box_lib/trunk/box_lib.mac'
24
include '../../../develop/libraries/box_lib/trunk/box_lib.mac'
25
include 'lang.inc'
25
include 'lang.inc'
26
 
26
 
27
@use_library
27
@use_library
28
 
28
 
29
start:
29
start:
30
	load_libraries l_libs_start,l_libs_end
30
	load_libraries l_libs_start,l_libs_end
31
	;¯à®¢¥àª  ­  ᪮«ìª® 㤠筮 § £ã§¨« áì ­ è  ¡¨¡«¨®â¥ª 
31
	;¯à®¢¥àª  ­  ᪮«ìª® 㤠筮 § £ã§¨« áì ­ è  ¡¨¡«¨®â¥ª 
32
	mov	ebp,lib_0
32
	mov	ebp,lib_0
33
	cmp	dword [ebp+ll_struc_size-4],0
33
	cmp	dword [ebp+ll_struc_size-4],0
34
	jz	@f
34
	jz	@f
35
		mcall -1 ;exit not correct
35
		mcall SF_TERMINATE_PROCESS
36
	@@:
36
	@@:
37
	mcall 40,0x80000027
37
	mcall SF_SET_EVENTS_MASK,0x80000027
38
	mcall 48, 3, sys_colors, 40
38
	mcall SF_STYLE_SETTINGS, SSF_GET_COLORS, sys_colors, 40
39
	edit_boxes_set_sys_color edit1,editboxes_end,sys_colors
39
	edit_boxes_set_sys_color edit1,editboxes_end,sys_colors
40
 
40
 
41
red:
41
red:
42
    call draw_window
42
    call draw_window
-
 
43
 
43
 
44
align 4
44
still:
45
still:
45
    mcall 10		; äã­ªæ¨ï 10 - ¦¤ âì ᮡëâ¨ï
46
    mcall SF_WAIT_EVENT
46
 
47
 
47
    cmp  eax,1		; ¯¥à¥à¨á®¢ âì ®ª­® ?
48
    cmp  eax,1		; ¯¥à¥à¨á®¢ âì ®ª­® ?
48
    je	 red		; ¥á«¨ ¤  - ­  ¬¥âªã red
49
    je	 red		; ¥á«¨ ¤  - ­  ¬¥âªã red
49
    cmp  eax,2		; ­ ¦ â  ª« ¢¨è  ?
50
    cmp  eax,2		; ­ ¦ â  ª« ¢¨è  ?
50
    je	 key		; ¥á«¨ ¤  - ­  key
51
    je	 key		; ¥á«¨ ¤  - ­  key
51
    cmp  eax,3		; ­ ¦ â  ª­®¯ª  ?
52
    cmp  eax,3		; ­ ¦ â  ª­®¯ª  ?
52
    je	 button 	; ¥á«¨ ¤  - ­  button
53
    je	 button 	; ¥á«¨ ¤  - ­  button
53
    cmp  eax,6
54
    cmp  eax,6
54
    je	 mouse
55
    je	 mouse
55
 
56
 
56
    jmp  still		; ¥á«¨ ¤à㣮¥ ᮡë⨥ - ¢ ­ ç «® 横« 
57
    jmp  still		; ¥á«¨ ¤à㣮¥ ᮡë⨥ - ¢ ­ ç «® 横« 
57
 
58
 
58
;---------------------------------------------------------------------
59
;---------------------------------------------------------------------
59
 
60
 
60
key:		       ; ­ ¦ â  ª« ¢¨è  ­  ª« ¢¨ âãà¥
61
key:		       ; ­ ¦ â  ª« ¢¨è  ­  ª« ¢¨ âãà¥
61
    mcall 2
62
    mcall SF_GET_KEY
62
	cmp ah,13 ;®¡à ¡®âª  ª­®¯ª¨ Enter
63
	cmp ah,13 ;®¡à ¡®âª  ª­®¯ª¨ Enter
63
	je @f
64
	je @f
64
		stdcall [edit_box_key], dword edit1
65
		stdcall [edit_box_key], dword edit1
65
		jmp still
66
		jmp still
66
	@@:
67
	@@:
67
	mov edi,string1
68
	mov edi,string1
68
	add edi,[edit1.size] ;ãáâ ­ ¢«¨¢ ¥¬ ¢ edi ª®­¥æ áâப¨
69
	add edi,[edit1.size] ;ãáâ ­ ¢«¨¢ ¥¬ ¢ edi ª®­¥æ áâப¨
69
	jmp read_str
70
	jmp read_str
70
    jmp still		; ¢¥à­ãâìáï ª ­ ç «ã 横« 
71
    jmp still		; ¢¥à­ãâìáï ª ­ ç «ã 横« 
71
 
72
 
72
read_str:
73
read_str:
73
    dec   edi
74
    dec   edi
74
    mov   esi, string1
75
    mov   esi, string1
75
 
76
 
76
    call  GetBase
77
    call  GetBase
77
 
78
 
78
    xor   ecx, ecx
79
    xor   ecx, ecx
79
    inc   ecx		; ecx = 1
80
    inc   ecx		; ecx = 1
80
 
81
 
81
make_bin:
82
make_bin:
82
    xor   eax, eax
83
    xor   eax, eax
83
 
84
 
84
next_digit:
85
next_digit:
85
    xor   edx, edx
86
    xor   edx, edx
86
    cmp   edi, esi
87
    cmp   edi, esi
87
    jb	  .done
88
    jb	  .done
88
 
89
 
89
    mov   dl, [edi]
90
    mov   dl, [edi]
90
    cmp   dl, '-'
91
    cmp   dl, '-'
91
    jne   @f
92
    jne   @f
92
    neg   eax
93
    neg   eax
93
    jmp   .done
94
    jmp   .done
94
@@:
95
@@:
95
    cmp   dl, 'F'
96
    cmp   dl, 'F'
96
    jbe   @f
97
    jbe   @f
97
    and   dl, 11011111b
98
    and   dl, 11011111b
98
@@:
99
@@:
99
    sub   dl, '0'
100
    sub   dl, '0'
100
    cmp   dl, 9
101
    cmp   dl, 9
101
    jbe   @f
102
    jbe   @f
102
    sub   dl, 'A'-'9'-1
103
    sub   dl, 'A'-'9'-1
103
@@:
104
@@:
104
    cmp   dl, bl
105
    cmp   dl, bl
105
    jb	  @f
106
    jb	  @f
106
    ; ‡¤¥áì ®¡à ¡®â âì ®è¨¡ªã
107
    ; ‡¤¥áì ®¡à ¡®â âì ®è¨¡ªã
107
 
108
 
108
    jmp   .done
109
    jmp   .done
109
@@:
110
@@:
110
    push  ecx
111
    push  ecx
111
    xchg  eax, ecx
112
    xchg  eax, ecx
112
    mul   edx ;        edx:eax = eax * edx
113
    mul   edx ;        edx:eax = eax * edx
113
    add   ecx, eax
114
    add   ecx, eax
114
    pop   eax
115
    pop   eax
115
    mul   ebx
116
    mul   ebx
116
    xchg  eax, ecx
117
    xchg  eax, ecx
117
    dec   edi
118
    dec   edi
118
    jmp   next_digit
119
    jmp   next_digit
119
 
120
 
120
.done:
121
.done:
121
   mov	  [num], eax	; á®å࠭塞 ¢¢¥¤¥­­®¥ ç¨á«®
122
   mov	  [num], eax	; á®å࠭塞 ¢¢¥¤¥­­®¥ ç¨á«®
122
   jmp	  red
123
   jmp	  red
123
 
124
 
124
;---------------------------------------------------------------------
125
;---------------------------------------------------------------------
125
 
126
 
126
button:
127
button:
127
	mcall 17		; 17 - ¯®«ãç¨âì ¨¤¥­â¨ä¨ª â®à ­ ¦ â®© ª­®¯ª¨
128
	mcall SF_GET_BUTTON
128
	cmp   ah, 1 	; ¥á«¨ … ­ ¦ â  ª­®¯ª  á ­®¬¥à®¬ 1,
129
	cmp   ah, 1 	; ¥á«¨ … ­ ¦ â  ª­®¯ª  á ­®¬¥à®¬ 1,
129
	jne   @f
130
	jne   @f
130
		mcall -1
131
		mcall SF_TERMINATE_PROCESS
131
	@@:
132
	@@:
132
	cmp ah, 2
133
	cmp ah, 2
133
	jne @f
134
	jne @f
134
		shl [num], 1
135
		shl [num], 1
135
		jmp red
136
		jmp red
136
	@@:
137
	@@:
137
	cmp ah, 3
138
	cmp ah, 3
138
	jne @f
139
	jne @f
139
		shr [num], 1
140
		shr [num], 1
140
		jmp red
141
		jmp red
141
	@@:
142
	@@:
142
	cmp ah, 4
143
	cmp ah, 4
143
	jne @f
144
	jne @f
144
		sar [num], 1
145
		sar [num], 1
145
		jmp red
146
		jmp red
146
	@@:
147
	@@:
147
	cmp ah, 5
148
	cmp ah, 5
148
	jne @f
149
	jne @f
149
		mov edi,string1
150
		mov edi,string1
150
		add edi,[edit1.size] ;ãáâ ­ ¢«¨¢ ¥¬ ¢ edi ª®­¥æ áâப¨
151
		add edi,[edit1.size] ;ãáâ ­ ¢«¨¢ ¥¬ ¢ edi ª®­¥æ áâப¨
151
		jmp read_str
152
		jmp read_str
152
		;jmp red
153
		;jmp red
153
	@@:
154
	@@:
154
	jmp still
155
	jmp still
155
 
156
 
156
mouse:
157
mouse:
157
	stdcall [edit_box_mouse], edit1
158
	stdcall [edit_box_mouse], edit1
158
	jmp still
159
	jmp still
159
 
160
 
160
;------------------------------------------------
161
;------------------------------------------------
161
    draw_window:
162
draw_window:
162
;------------------------------------------------
163
;------------------------------------------------
163
	mcall	48, 3, sys_colors, 40
164
	mcall	SF_STYLE_SETTINGS, SSF_GET_COLORS, sys_colors, 40
164
 
165
 
165
    mcall 12, 1
166
    mcall SF_REDRAW, SSF_BEGIN_DRAW
166
	mov	edx, 0x14000000
167
	mov	edx, 0x14000000
167
	or	edx, [sys_colors.work]
168
	or	edx, [sys_colors.work]
168
	;mov	esi, 0x80000000
169
	;mov	esi, 0x80000000
169
	;or	esi, [sys_colors.grab_text]
170
	;or	esi, [sys_colors.grab_text]
170
    mcall 0, 200*65536+WIN_W, 200*65536+179, ,,title
171
    mcall SF_CREATE_WINDOW, 200*65536+WIN_W, 200*65536+179, ,,title
171
 
172
 
172
	
173
	
173
    mcall  8,         15*65536+42,106*65536+ 21, 2, [sys_colors.work_button] ; ª­®¯ª  shl
174
    mcall  SF_DEFINE_BUTTON, 15*65536+42,106*65536+ 21, 2, [sys_colors.work_button] ; ª­®¯ª  shl
174
    mcall   ,         70*65536+42,             ,  , ; ª­®¯ª  sal
175
    mcall   ,         70*65536+42,             ,  , ; ª­®¯ª  sal
175
    mcall   , (WIN_W-55)*65536+42,             , 3, ; ª­®¯ª  shr
176
    mcall   , (WIN_W-55)*65536+42,             , 3, ; ª­®¯ª  shr
176
    mcall   ,(WIN_W-111)*65536+42,             , 4, ; ª­®¯ª  sar
177
    mcall   ,(WIN_W-111)*65536+42,             , 4, ; ª­®¯ª  sar
177
    mcall   , (WIN_W-72)*65536+58,145*65536+ 21, 5, ; ª­®¯ª  Ok
178
    mcall   , (WIN_W-72)*65536+58,145*65536+ 21, 5, ; ª­®¯ª  Ok
178
 
179
 
179
	mov	ecx, 0x90000000
180
	mov	ecx, 0x90000000
180
	or	ecx, [sys_colors.work_text]
181
	or	ecx, [sys_colors.work_text]
181
    mcall  4, 15*65536+30,   , binstr,
182
    mcall  SF_DRAW_TEXT, 15*65536+30,   , binstr,
182
    mcall   , 15*65536+46,   , decstr,
183
    mcall   , 15*65536+46,   , decstr,
183
    mcall   , 15*65536+62,   ,sdecstr,
184
    mcall   , 15*65536+62,   ,sdecstr,
184
    mcall   , 15*65536+78,   , hexstr,
185
    mcall   , 15*65536+78,   , hexstr,
185
    mcall   , 15*65536+150,  , numstr,
186
    mcall   , 15*65536+150,  , numstr,
186
 
187
 
187
	mov	ecx, 0x90000000
188
	mov	ecx, 0x90000000
188
	or	ecx, [sys_colors.work_button_text]
189
	or	ecx, [sys_colors.work_button_text]
189
    mcall  , 23*65536+109, , shl_sal_sar_shr_button_caption
190
    mcall  , 23*65536+109, , shl_sal_sar_shr_button_caption
190
	mcall  , (WIN_W-59)*65536+149,	, Okstr,
191
	mcall  , (WIN_W-59)*65536+149,	, Okstr,
191
    mov    ecx, [num]
192
    mov    ecx, [num]
192
 
193
 
193
	mov esi, [sys_colors.work_text]
194
	mov esi, [sys_colors.work_text]
194
	or  esi, 0x90000000
195
	or  esi, 0x90000000
195
 
196
 
196
    mcall  47, 10*65536,   ,(WIN_W-92)*65536+62,    ; 10-­ ï á® §­ ª®¬
197
    mcall SF_DRAW_NUMBER, 10*65536,   ,(WIN_W-92)*65536+62,    ; 10-­ ï á® §­ ª®¬
197
	BIN_LINE_BLOCK_W = 76
198
	BIN_LINE_BLOCK_W = 76
198
    mcall 47, 8*65536+512,,(WIN_W-BIN_LINE_BLOCK_W)*65536+30 ; 2-­ ï	
199
    mcall SF_DRAW_NUMBER, 8*65536+512,,(WIN_W-BIN_LINE_BLOCK_W)*65536+30 ; 2-­ ï	
199
    ror    ecx, 8
200
    ror    ecx, 8
200
	mov    edx, (WIN_W-BIN_LINE_BLOCK_W*2)*65536+30
201
	mov    edx, (WIN_W-BIN_LINE_BLOCK_W*2)*65536+30
201
	mcall
202
	mcall
202
    ror    ecx, 8
203
    ror    ecx, 8
203
    mov    edx, (WIN_W-BIN_LINE_BLOCK_W*3)*65536+30
204
    mov    edx, (WIN_W-BIN_LINE_BLOCK_W*3)*65536+30
204
	mcall
205
	mcall
205
    ror    ecx, 8
206
    ror    ecx, 8
206
    mov    edx, (WIN_W-BIN_LINE_BLOCK_W*4)*65536+30
207
    mov    edx, (WIN_W-BIN_LINE_BLOCK_W*4)*65536+30
207
	mcall
208
	mcall
208
    ror    ecx, 8
209
    ror    ecx, 8
209
    mov    [minus], '+'
210
    mov    [minus], '+'
210
    jnc    @f
211
    jnc    @f
211
    mov    [minus], '-'
212
    mov    [minus], '-'
212
    neg    ecx
213
    neg    ecx
213
@@:
214
@@:
214
    mcall   , 10*65536,   ,(WIN_W-92)*65536+46,    ; 10-­ ï
215
    mcall   , 10*65536,   ,(WIN_W-92)*65536+46,    ; 10-­ ï
215
	mcall   , 8*65536+256,,(WIN_W-76)*65536+78,    ; 16-­ ï
216
	mcall   , 8*65536+256,,(WIN_W-76)*65536+78,    ; 16-­ ï
216
	mov   ecx,esi
217
	mov   ecx,esi
217
    mcall  4, (WIN_W-102)*65536+61, , minus, 1
218
    mcall SF_DRAW_TEXT, (WIN_W-102)*65536+61, , minus, 1
218
    mcall 38, 15*65536+WIN_W-15, 137*65536+137, [sys_colors.work_graph]
219
    mcall SF_DRAW_LINE, 15*65536+WIN_W-15, 137*65536+137, [sys_colors.work_graph]
219
	stdcall [edit_box_draw], edit1
220
	stdcall [edit_box_draw], edit1
220
    mcall 12, 2 		   ; äã­ªæ¨ï 12: á®®¡é¨âì Ž‘ ®¡ ®âà¨á®¢ª¥ ®ª­ 
221
    mcall SF_REDRAW, SSF_END_DRAW
221
 
222
 
222
ret
223
ret
223
 
224
 
224
 
225
 
225
;-------------------------------------------------
226
;-------------------------------------------------
226
    GetBase:
227
    GetBase:
227
;-------------------------------------------------
228
;-------------------------------------------------
228
    mov   ebx, 10
229
    mov   ebx, 10
229
    cmp   edi, esi
230
    cmp   edi, esi
230
    jb	  .done
231
    jb	  .done
231
 
232
 
232
    mov   al, [edi]
233
    mov   al, [edi]
233
    cmp   al, 'H'
234
    cmp   al, 'H'
234
    jbe   @f
235
    jbe   @f
235
    and   al, 11011111b
236
    and   al, 11011111b
236
@@:
237
@@:
237
    cmp   al, 'H'
238
    cmp   al, 'H'
238
    jne   @f
239
    jne   @f
239
    mov   ebx, 16
240
    mov   ebx, 16
240
    dec   edi
241
    dec   edi
241
    jmp   .done
242
    jmp   .done
242
 
243
 
243
@@:
244
@@:
244
    cmp   al, 'D'
245
    cmp   al, 'D'
245
    jne   @f
246
    jne   @f
246
    mov   ebx, 10
247
    mov   ebx, 10
247
    dec   edi
248
    dec   edi
248
    jmp   .done
249
    jmp   .done
249
 
250
 
250
@@:
251
@@:
251
    cmp   al, 'B'
252
    cmp   al, 'B'
252
    jne   .done
253
    jne   .done
253
    mov   ebx, 2
254
    mov   ebx, 2
254
    dec   edi
255
    dec   edi
255
 
256
 
256
.done:
257
.done:
257
ret
258
ret
258
 
259
 
259
;-------------------------------------------------
260
;-------------------------------------------------
260
string1:
261
string1:
261
  db  34 dup(' ')
262
  db  34 dup(' ')
262
string1_end:
263
string1_end:
263
  num	dd  0
264
  num	dd  0
264
 
265
 
265
 
266
 
266
 title db 'hex2dec2bin 0.5',0
267
 title db 'hex2dec2bin 0.5',0
267
 minus	db '-',0
268
 minus	db '-',0
268
 hexstr db 'hex:',0
269
 hexstr db 'hex:',0
269
 binstr db 'bin:',0
270
 binstr db 'bin:',0
270
 decstr db 'dec:',0
271
 decstr db 'dec:',0
271
 sdecstr db 'signed dec:',0
272
 sdecstr db 'signed dec:',0
272
 shl_sal_sar_shr_button_caption db 'shl    sal                    sar    shr',0
273
 shl_sal_sar_shr_button_caption db 'shl    sal                    sar    shr',0
273
 
274
 
274
if lang eq ru
275
if lang eq ru
275
	numstr db '—¨á«®:',0
276
	numstr db '—¨á«®:',0
276
	Okstr db '‚¢®¤',0
277
	Okstr db '‚¢®¤',0
277
	head_f_i:
-
 
278
	head_f_l db '‘¨á⥬­ ï ®è¨¡ª ',0
-
 
279
else
278
else
280
	numstr db 'Number:',0
279
	numstr db 'Number:',0
281
	Okstr db 'Enter',0
280
	Okstr db 'Enter',0
282
	head_f_i:
-
 
283
	head_f_l db 'System error',0
-
 
284
end if
281
end if
285
 
282
 
286
mouse_dd dd 0
283
mouse_dd dd 0
287
edit1 edit_box (WIN_W-67-82), 67, 146, 0xffffff, 0xff, 0x80ff, 0, 0x90000000, (string1_end-string1), string1 , mouse_dd, ed_focus+ed_always_focus
284
edit1 edit_box (WIN_W-67-82), 67, 146, 0xffffff, 0xff, 0x80ff, 0, 0x90000000, (string1_end-string1), string1 , mouse_dd, ed_focus+ed_always_focus
288
 
285
 
289
editboxes_end:
286
editboxes_end:
290
 
287
 
291
system_dir_0 db '/sys/lib/'
288
system_dir_0 db '/sys/lib/'
292
lib_name_0 db 'box_lib.obj',0
289
lib_name_0 db 'box_lib.obj',0
293
 
290
 
294
l_libs_start:
291
l_libs_start:
295
	lib_0 l_libs lib_name_0, library_path, system_dir_0,import_box_lib
292
	lib_0 l_libs lib_name_0, library_path, system_dir_0,import_box_lib
296
l_libs_end:
293
l_libs_end:
297
 
294
 
298
align 4
295
align 4
299
import_box_lib:
296
import_box_lib:
300
	;dd sz_init1
297
	;dd sz_init1
301
	edit_box_draw dd sz_edit_box_draw
298
	edit_box_draw dd sz_edit_box_draw
302
	edit_box_key dd sz_edit_box_key
299
	edit_box_key dd sz_edit_box_key
303
	edit_box_mouse dd sz_edit_box_mouse
300
	edit_box_mouse dd sz_edit_box_mouse
304
	;edit_box_set_text dd sz_edit_box_set_text
301
	;edit_box_set_text dd sz_edit_box_set_text
305
dd 0,0
302
dd 0,0
306
	;sz_init1 db 'lib_init',0
303
	;sz_init1 db 'lib_init',0
307
	sz_edit_box_draw db 'edit_box',0
304
	sz_edit_box_draw db 'edit_box_draw',0
308
	sz_edit_box_key db 'edit_box_key',0
305
	sz_edit_box_key db 'edit_box_key',0
309
	sz_edit_box_mouse db 'edit_box_mouse',0
306
	sz_edit_box_mouse db 'edit_box_mouse',0
310
	;sz_edit_box_set_text db 'edit_box_set_text',0
307
	;sz_edit_box_set_text db 'edit_box_set_text',0
311
 
308
 
312
i_end:
309
i_end:
313
	sys_colors system_colors
310
	sys_colors system_colors
314
	sys_path rb 4096
311
	sys_path rb 4096
315
	library_path rb 4096
312
	library_path rb 4096
316
	rb 0x400	; stack
313
	rb 0x400	; stack
317
e_end:			; ¬¥âª  ª®­æ  ¯à®£à ¬¬ë
314
e_end:			; ¬¥âª  ª®­æ  ¯à®£à ¬¬ë