Subversion Repositories Kolibri OS

Rev

Rev 949 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 949 Rev 1361
Line 27... Line 27...
27
  dd 0x01        ; header version
27
  dd 0x01	 ; header version
28
  dd START       ; program start
28
  dd START	 ; program start
29
  dd program_end ; program image size
29
  dd program_end ; program image size
30
  dd stacktop    ; required amount of memory
30
  dd stacktop	 ; required amount of memory
31
  dd stacktop    ; stack
31
  dd stacktop	 ; stack
32
  dd params,0x0  ; parameters,icon
32
  dd params,cur_dir_path  ; parameters,icon
Line 33... Line 33...
33
 
33
 
34
include 'lang.inc'
34
include 'lang.inc'
35
include '..\..\..\macros.inc'
35
include '..\..\..\macros.inc'
36
purge add,sub    ; macros.inc does incorrect substitution
36
purge add,sub	 ; macros.inc does incorrect substitution
Line -... Line 37...
-
 
37
include 'fasm.inc'
-
 
38
 
-
 
39
include '..\..\..\develop\libraries\box_lib\trunk\editbox.mac'
-
 
40
include '..\..\..\develop\libraries\box_lib\load_lib.mac'
-
 
41
  @use_library
-
 
42
 
37
include 'fasm.inc'
43
 
Line 38... Line 44...
38
 
44
 
-
 
45
center fix true
-
 
46
 
-
 
47
START:	    ; Start of execution
-
 
48
sys_load_library  library_name, cur_dir_path, library_path, system_path, \
-
 
49
  err_message_found_lib, head_f_l, myimport, err_message_import, head_f_i
-
 
50
 
-
 
51
  cmp eax,-1
-
 
52
  jne @f
-
 
53
    mcall -1 ;exit if not open box_lib.obj
39
center fix true
54
  @@:
40
 
55
  mcall 40,0x27 ;¬ áª  á¨á⥬­ëå ᮡë⨩
41
START:	    ; Start of execution
56
 
42
        mov     edi, fileinfos
57
	mov	edi, fileinfos
43
        mov     ecx, (fileinfos_end-fileinfos)/4
58
	mov	ecx, (fileinfos_end-fileinfos)/4
Line 96... Line 111...
96
 
111
 
97
still:  
112
still:	
98
    push 10          ; Wait here for event
113
    push 10	     ; Wait here for event
99
    pop eax 
114
    pop eax 
-
 
115
    mcall
-
 
116
    cmp al,6
-
 
117
    jne @f
-
 
118
      call mouse
100
    mcall 
119
    @@:
101
    dec eax 
120
    dec eax 
102
    je  red          ; Redraw request
121
    je	red	     ; Redraw request
103
    dec eax 
122
    dec eax 
Line 104... Line 123...
104
    jne button       ; Button in buffer
123
    jne button	     ; Button in buffer
105
 
124
 
106
key:                 ; Key
125
key:		     ; Key
-
 
126
    mov  al,2	     ; Read it and ignore
-
 
127
    mcall
-
 
128
 
-
 
129
    push dword edit1
-
 
130
    call [edit_box_key]
-
 
131
    push dword edit2
-
 
132
    call [edit_box_key]
-
 
133
    push dword edit3
107
    mov  al,2        ; Read it and ignore
134
    call [edit_box_key]
Line 108... Line 135...
108
    mcall
135
 
Line 109... Line 136...
109
    jmp  still
136
    jmp  still
Line 140... Line 167...
140
 
167
 
141
   norundebug:
168
   norundebug:
142
    mov  ecx,5
169
    mov  ecx,5
Line 143... Line -...
143
    mov  [ya],ecx
-
 
144
 
-
 
145
    cmp  ah,11	   ; Infile
-
 
146
    je   f1
-
 
147
    cmp  ah,12	   ; Outfile
-
 
148
    je   f2
-
 
149
    cmp  ah,13	   ; Path
170
    mov  [ya],ecx
150
    je   f3
171
 
Line 151... Line 172...
151
    cmp  ah,14
172
    cmp  ah,14
Line 157... Line 178...
157
        xor     [bGenerateDebugInfo], 1
178
	xor	[bGenerateDebugInfo], 1
158
        mcall   8,,,0x8000000E
179
	mcall	8,,,0x8000000E
159
        call    draw_checkbox
180
	call	draw_checkbox
160
        jmp     still
181
	jmp	still
Line -... Line 182...
-
 
182
 
-
 
183
mouse:
-
 
184
  push dword edit1
161
 
185
  call [edit_box_mouse]
-
 
186
  push dword edit2
-
 
187
  call [edit_box_mouse]
-
 
188
  push dword edit3
-
 
189
  call [edit_box_mouse]
Line -... Line 190...
-
 
190
  ret
162
draw_window:
191
 
Line 163... Line 192...
163
 
192
draw_window:
Line 164... Line 193...
164
    pusha
193
    pusha
Line 179... Line 208...
179
 
208
 
180
    mpack ecx,1,1
209
    mpack ecx,1,1
181
    mov   ebx,[pinfo.box.width]
210
    mov   ebx,[pinfo.box.width]
Line 182... Line -...
182
    sub   ebx,10
-
 
183
 
-
 
184
    push  ecx
-
 
185
    madd  ecx, 14*3+16+2, 14*3+16+2
-
 
186
    mcall 38,,,[sc.work_graph]
-
 
187
    pop   ecx
-
 
188
 
-
 
189
    sub   ebx,MAGIC1+3
-
 
190
    mcall
211
    sub   ebx,10
191
    madd  ecx, 14, 14
-
 
192
    mcall
-
 
193
    madd  ecx, 14, 14
-
 
194
    mcall
-
 
195
    madd  ecx, 14, 14
-
 
196
    mcall
-
 
197
    push  ebx
-
 
198
    mpack ebx,MAGIC1,MAGIC1
-
 
199
    sub   ecx, 14*3
-
 
200
    mcall
-
 
201
    mov   ebx,[esp-2]
-
 
202
    pop   bx
-
 
203
    mcall
-
 
204
    add   esp,2
212
 
205
 
-
 
206
    mpack ebx,0,MAGIC1-1
-
 
207
    mpack ecx,1+1, 14-2
213
mov eax,8
208
    mcall 8,,,0x4000000B       ; Button: Enter Infile
214
mov edx,0x4000000B
209
    madd  ecx, 14,0
215
    madd  ecx, 14,0
210
    mcall  ,,,0x4000000C       ; Button: Enter Outfile
216
;    mcall  ,,,0x4000000C       ; Button: Enter Outfile
Line 211... Line 217...
211
    madd  ecx, 14,0
217
    madd  ecx, 14,0
212
    mcall  ,,,0x4000000D       ; Button: Enter Path
218
;    mcall  ,,,0x4000000D       ; Button: Enter Path
213
 
219
 
214
    mpack ebx,[pinfo.box.width],MAGIC1
220
    mpack ebx,[pinfo.box.width],MAGIC1
Line 227... Line 233...
227
    mov  edx,text
233
    mov  edx,text
228
    mov  esi,text.line_size
234
    mov  esi,text.line_size
229
    mov  eax,4
235
    mov  eax,4
230
   newline:
236
   newline:
231
    mcall
237
    mcall
232
    add  ebx, 14
238
    add  ebx, 16 ;14
233
    add  edx,text.line_size
239
    add  edx,text.line_size
234
    cmp  byte[edx],'x'
240
    cmp  byte[edx],'x'
235
    jne  newline
241
    jne  newline
Line 236... Line 242...
236
 
242
 
Line 253... Line 259...
253
    div   cl
259
    div   cl
254
    cmp   al,MAX_PATH
260
    cmp   al,MAX_PATH
255
    jbe   @f
261
    jbe   @f
256
    mov   al,MAX_PATH
262
    mov   al,MAX_PATH
257
@@: movzx esi,al
263
@@: movzx esi,al
258
    mcall 4,,[sc.work_text],infile
-
 
259
    add   ebx,14
-
 
260
    mcall ,,,outfile
-
 
261
    add   ebx,14
-
 
262
    mcall ,,,path
-
 
Line 263... Line 264...
263
 
264
 
264
        call    draw_checkbox
-
 
265
 
265
    call draw_checkbox
Line -... Line 266...
-
 
266
    call draw_messages
-
 
267
 
-
 
268
    push dword edit1
-
 
269
    call [edit_box_draw]
-
 
270
    push dword edit2
-
 
271
    call [edit_box_draw]
-
 
272
    push dword edit3
266
    call  draw_messages
273
    call [edit_box_draw]
Line 267... Line 274...
267
 
274
 
268
    mcall  12,2 ; End of Draw
275
    mcall  12,2 ; End of Draw
Line 326... Line 333...
326
    madd   ebx,1,1
333
    madd   ebx,1,1
327
    mcall
334
    mcall
328
    pop    ecx ebx
335
    pop    ecx ebx
329
    ret
336
    ret
Line 330... Line -...
330
 
-
 
331
; read string
-
 
332
 
-
 
333
f1: mov  [addr],infile
-
 
334
    add  [ya], 14*0
-
 
335
    jmp  rk
-
 
336
f2: mov  [addr],outfile
-
 
337
    add  [ya], 14*1
-
 
338
    jmp  rk
-
 
339
f3: mov  [addr],path
-
 
340
    add  [ya], 14*2
-
 
341
rk:
-
 
342
 
-
 
343
    mov  edi,[addr]
-
 
344
    mov  al,0
-
 
345
    mov  ecx,MAX_PATH
-
 
346
    add  edi,ecx
-
 
347
    dec  edi
-
 
348
    std
-
 
349
    repe scasb
-
 
350
    sub  ecx,MAX_PATH
-
 
351
    neg  ecx
-
 
352
    mov  al,$1C ; ''
-
 
353
    add  edi,2
-
 
354
    push  edi
-
 
355
    cld
-
 
356
    rep  stosb
-
 
357
    call print_text
-
 
358
    pop edi
-
 
359
f11:mcall  10
-
 
360
    cmp    eax,2
-
 
361
    jne read_done
-
 
362
    mcall; 2
-
 
363
    shr    eax,8
-
 
364
    cmp    al,13
-
 
365
    je	  read_done
-
 
366
    cmp    al,8
-
 
367
    jne nobs
-
 
368
    cmp    edi,[addr]
-
 
369
    je	  f11
-
 
370
    sub    edi,1
-
 
371
    mov    byte[edi],$1C ; '_'
-
 
372
    call   print_text
-
 
373
    jmp    f11
-
 
374
   nobs:
-
 
375
    movzx  ebx,al
-
 
376
    sub    ebx,$20
-
 
377
    jle    f11
-
 
378
    sub    al,[sub_table+ebx]
-
 
379
   keyok:
-
 
380
    mov    ecx,[addr]
-
 
381
    add    ecx,MAX_PATH
-
 
382
    cmp    edi,ecx
-
 
383
    jae    f11
-
 
384
    mov    [edi],al
-
 
385
 
-
 
386
    call   print_text
-
 
387
    inc    edi
-
 
388
    jmp f11
-
 
389
 
-
 
390
  read_done:
-
 
391
 
-
 
392
    mov    ecx,[addr]
-
 
393
    add    ecx,MAX_PATH
-
 
394
    sub    ecx,edi
-
 
395
    mov    al,0;' '
-
 
396
    cld
-
 
397
    rep    stosb
-
 
398
    call   print_text
-
 
399
 
-
 
400
    jmp    still
-
 
401
 
-
 
402
print_text:
-
 
403
 
-
 
404
    mpack ebx,MAGIC1+6,[pinfo.box.width]
-
 
405
    sub   ebx,MAGIC1*2+19
-
 
406
    movzx esi,bx
-
 
407
    mov   ecx,[ya-2]
-
 
408
    mov   cx,8
-
 
409
    mcall 13,,,[sc.work]
-
 
410
 
-
 
411
    mpack ebx,MAGIC1+6,[ya]
-
 
412
    mov   eax,esi
-
 
413
    mov   cl,6
-
 
414
    div   cl
-
 
415
    cmp   al,MAX_PATH
-
 
416
    jbe   @f
-
 
417
    mov   al,MAX_PATH
-
 
418
@@: movzx esi,al
-
 
419
    mcall 4,,[sc.work_text],[addr]
-
 
420
 
-
 
421
    ret
-
 
Line 422... Line 337...
422
 
337
 
Line -... Line 338...
-
 
338
 
-
 
339
; DATA
-
 
340
 
-
 
341
if lang eq ru
-
 
342
text:
-
 
343
  db ' ‚å” ©«:'
-
 
344
.line_size = $-text
-
 
345
  db '‚ë唠©«:'
-
 
346
  db '   ãâì:'
-
 
347
  db 'x'
-
 
348
 
-
 
349
  s_compile db 'Š®¬¯¨«.'
-
 
350
  s_run     db ' ã᪠ '
-
 
351
  s_debug   db 'Žâ« ¤ª '
-
 
352
  s_dbgdescr	  db	  '‘®§¤ ¢ âì ®â« ¤®ç­ãî ¨­ä®à¬ æ¨î',0
-
 
353
 
-
 
354
  err_message_import db 'Žè¨¡ª  ¯à¨ ¨¬¯®à⥠box_lib.obj',0
-
 
355
  err_message_found_lib db 'Žè¨¡ª  ¯à¨ ¯®¨áª¥ box_lib.obj',0 ;áâப , ª®â®à ï ¡ã¤¥â ¢ áä®à¬¨à®¢ ­­®¬ ®ª­¥, ¥á«¨ ¡¨¡«¨®â¥ª  ­¥ ¡ã¤¥â ­ ©¤¥­ 
-
 
356
  head_f_i: 
-
 
357
  head_f_l db '‘¨á⥬­ ï ®è¨¡ª ',0 ;§ £®«®¢®ª ®ª­ , ¯à¨ ¢®§­¨ª­®¢¥­¨¨ ®è¨¡ª¨
423
 
358
  system_path db '/sys/lib/'
424
; DATA
359
  library_name db 'box_lib.obj',0
425
 
360
else
426
text:
361
text:
427
  db ' INFILE:'
362
  db ' INFILE:'
428
.line_size = $-text
363
.line_size = $-text
Line 429... Line 364...
429
  db 'OUTFILE:'
364
  db 'OUTFILE:'
430
  db '   PATH:'
365
  db '   PATH:'
431
  db 'x'
366
  db 'x'
432
 
-
 
433
s_compile db 'COMPILE'
367
 
Line -... Line 368...
-
 
368
  s_compile db 'COMPILE'
-
 
369
  s_run     db '  RUN  '
-
 
370
  s_debug   db ' DEBUG '
-
 
371
  s_dbgdescr	  db	  'Generate debug information',0
-
 
372
 
-
 
373
  err_message_import db 'Error on load import library box_lib.obj',0
-
 
374
  err_message_found_lib db 'Sorry I cannot found library box_lib.obj',0 ;áâப , ª®â®à ï ¡ã¤¥â ¢ áä®à¬¨à®¢ ­­®¬ ®ª­¥, ¥á«¨ ¡¨¡«¨®â¥ª  ­¥ ¡ã¤¥â ­ ©¤¥­ 
-
 
375
  head_f_i: 
-
 
376
  head_f_l db 'System error',0 ;§ £®«®¢®ª ®ª­ , ¯à¨ ¢®§­¨ª­®¢¥­¨¨ ®è¨¡ª¨
-
 
377
  system_path db '/sys/lib/'
-
 
378
  library_name db 'box_lib.obj',0
-
 
379
end if
-
 
380
 
-
 
381
myimport:
-
 
382
  edit_box_draw  dd aEdit_box_draw
-
 
383
  edit_box_key	 dd aEdit_box_key
-
 
384
  edit_box_mouse dd aEdit_box_mouse
-
 
385
  ;version_ed     dd aVersion_ed
-
 
386
 
-
 
387
  ;check_box_draw  dd aCheck_box_draw
-
 
388
  ;check_box_mouse dd aCheck_box_mouse
-
 
389
  ;version_ch      dd aVersion_ch
-
 
390
 
-
 
391
  dd 0,0
-
 
392
 
-
 
393
  aEdit_box_draw  db 'edit_box',0
-
 
394
  aEdit_box_key   db 'edit_box_key',0
-
 
395
  aEdit_box_mouse db 'edit_box_mouse',0
-
 
396
  ;aVersion_ed     db 'version_ed',0
-
 
397
 
-
 
398
  ;aCheck_box_draw  db 'check_box_draw',0
-
 
399
  ;aCheck_box_mouse db 'check_box_mouse',0
-
 
400
  ;aVersion_ch      db 'version_ch',0
-
 
401
 
-
 
402
edit1 edit_box 153, 56, 1, 0xe0ffff, 0xff, 0x80ff, 0, 0xa000, MAX_PATH+$, infile, mouse_dd, 0, 11,11
434
s_run     db '  RUN  '
403
edit2 edit_box 153, 56, 17, 0xe0ffff, 0xff, 0x80ff, 0, 0xa000, MAX_PATH+$, outfile, mouse_dd, 0, 7,7
435
s_debug   db ' DEBUG '
404
edit3 edit_box 153, 56, 33, 0xe0ffff, 0xff, 0x80ff, 0, 0xa000, MAX_PATH+$, path, mouse_dd, 0, 6,6
436
 
405
 
437
s_dbgdescr      db      'Generate debug information',0
406
mouse_dd dd 0 ;íóæíî äëÿ Shift-à â editbox
438
 
407
 
Line 578... Line 547...
578
times $08 db $00
547
times $08 db $00
Line 579... Line 548...
579
 
548
 
Line 580... Line 549...
580
;include_debug_strings
549
;include_debug_strings
-
 
550
 
-
 
551
  params db 0 ; 'TINYPAD.ASM,TINYPAD,/HD/1/TPAD4/',
-
 
552
  cur_dir_path rb 4096
581
 
553
  library_path rb 4096
582
params db 0 ; 'TINYPAD.ASM,TINYPAD,/HD/1/TPAD4/',
-
 
Line -... Line 554...
-
 
554
 
583
program_end:
555
program_end:
Line 584... Line 556...
584
rb 1000h
556
 
Line 585... Line 557...
585
 
557
rb 1000h