Subversion Repositories Kolibri OS

Rev

Rev 3662 | Go to most recent revision | Blame | Last modification | View Log | Download | RSS feed

  1. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  2. ;;                                                 ;;
  3. ;;  flat assembler source                          ;;
  4. ;;  Copyright (c) 1999-2012, Tomasz Grysztar       ;;
  5. ;;  All rights reserved.                           ;;
  6. ;;                                                 ;;
  7. ;;  KolibriOS port by KolibriOS Team               ;;
  8. ;;  Menuet port by VT                              ;;
  9. ;;                                                 ;;
  10. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  11.  
  12. NORMAL_MODE    = 8
  13. CONSOLE_MODE   = 32
  14.  
  15. MAGIC1         = 6*(text.line_size-1)+14
  16. MAX_PATH       = 100
  17.  
  18. APP_MEMORY     = 0x00800000
  19.  
  20. ;; Menuet header
  21.  
  22. appname equ "flat assembler "
  23. ;---------------------------------------------------------------------
  24.         use32
  25.         org 0x0
  26.         db 'MENUET01'  ; 8 byte id
  27.         dd 0x01  ; header version
  28.         dd START         ; program start
  29.         dd program_end ; program image size
  30.         dd stacktop      ; required amount of memory
  31.         dd stacktop      ; stack
  32.         dd params,cur_dir_path  ; parameters,icon
  33. ;---------------------------------------------------------------------
  34. include 'lang.inc'
  35. include '../../../macros.inc'
  36. purge add,sub    ; macros.inc does incorrect substitution
  37. include 'fasm.inc'
  38.  
  39. include '../../../develop/libraries/box_lib/trunk/box_lib.mac'
  40. include '../../../develop/libraries/box_lib/load_lib.mac'
  41.   @use_library
  42.  
  43. center fix true
  44. ;---------------------------------------------------------------------
  45. START:      ; Start of execution
  46.         mov     edi, fileinfos
  47.         mov     ecx, (fileinfos_end-fileinfos)/4
  48.         or      eax, -1
  49.         rep     stosd
  50.         push    68
  51.         pop     eax
  52.         push    11
  53.         pop     ebx
  54.         mcall
  55.  
  56.         cmp     [params],0
  57.         jz      start_1
  58.        
  59.                                                       ;---------GerdtR
  60.         or      ecx,-1                      
  61.         mov     esi,params
  62.         cmp     byte[esi],' '
  63.         jne     @f
  64.         mov     edi,esi
  65.         mov     al,' '
  66.         repe    scasb
  67.         mov     esi,edi
  68.         dec     esi
  69.     @@:
  70.  
  71.         mov     edi,dbgWord
  72.     @@: lodsb
  73.         scasb
  74.         jne     NoOutDebugInfo
  75.         cmp     byte[edi],0
  76.         jnz     @b
  77.  
  78.         cmp     byte[esi],' '
  79.         jne     NoOutDebugInfo
  80.  
  81.         mov     edi,esi
  82.         mov     al,' '
  83.         repe    scasb
  84.         mov     esi,edi
  85.         dec     esi
  86.  
  87.         mov     edi,params
  88.     @@: lodsb
  89.         stosb
  90.         test    al,al
  91.         jnz     @b
  92.  
  93.  ;       mov     [bGenerateDebugInfo], 1
  94.         or      dword[ch1_dbg.flags],10b
  95.  
  96.  
  97. NoOutDebugInfo:
  98.                                                    ;---------/GerdtR
  99.  
  100.  
  101.  
  102.  
  103.         mov     ecx,10
  104.         mov     eax,'    '
  105.         mov     edi,infile
  106.         push    ecx
  107.         cld
  108.         rep     stosd
  109.         mov     ecx,[esp]
  110.         mov     edi,outfile
  111.         rep     stosd
  112.         pop     ecx
  113.         mov     edi,path
  114.         rep     stosd
  115.        
  116.         mov      esi,params
  117. ;       DEBUGF  "params: %s\n",esi
  118.         mov     edi,infile
  119.         call    mov_param_str
  120. ;       mov     edi,infile
  121. ;       DEBUGF  " input: %s\n",edi
  122.         mov     edi,outfile
  123.         call    mov_param_str
  124. ;       mov     edi,outfile
  125. ;       DEBUGF  "output: %s\n",edi
  126.         mov     edi,path
  127.         call    mov_param_str
  128. ;       mov     edi,path
  129. ;       DEBUGF  "  path: %s\n",edi
  130.         dec     esi
  131.         cmp     [esi], dword ',run'
  132.         jne     @f
  133.         mov     [_run_outfile],1
  134. @@:
  135.         mov     [_mode],CONSOLE_MODE
  136.         jmp     start
  137. ;---------------------------------------------------------------------
  138. start_1:
  139. ;sys_
  140. load_libraries l_libs_start,load_lib_end
  141.  
  142.         cmp     eax,-1
  143.         jne     @f
  144.         mcall   -1 ;exit if not open box_lib.obj
  145. @@:
  146.         mcall   40,0x80000027 ;¬ áª  á¨á⥬­ëå ᮡë⨩
  147. ;---------------------------------------------------------------------
  148. init_checkboxes2 ch1_dbg,ch1_dbg+ch_struc_size
  149. ;---------------------------------------------------------------------
  150. ; OpenDialog initialisation
  151.         push dword OpenDialog_data
  152.         call dword [OpenDialog_Init]
  153. ;---------------------------------------------------------------------
  154. red:    ; Redraw
  155.         call    draw_window
  156.  
  157. still: 
  158.         mcall   10      ; Wait here for event
  159.         cmp     al,6
  160.         je      call_mouse
  161.         dec     eax
  162.         je      red          ; Redraw request
  163.         dec     eax
  164.         jne     button       ; Button in buffer
  165. key:                 ; Key
  166.         mcall   2       ; Read it and ignore
  167.        
  168.         push    dword edit1
  169.         call    [edit_box_key]
  170.         push    dword edit2
  171.         call    [edit_box_key]
  172.         push    dword edit3
  173.         call    [edit_box_key]
  174.         jmp     still
  175. ;---------------------------------------------------------------------
  176. call_mouse:
  177.         call    mouse
  178.         jmp     still
  179. ;---------------------------------------------------------------------
  180. button:    ; Button in Window
  181.         mcall   17
  182.         cmp     ah,1
  183.         jne     noclose
  184.         or      eax,-1
  185.         mcall
  186. ;---------------------------------------------------------------------
  187. noclose:    
  188.         cmp     ah,5 ;press button for OpenDialog
  189.         jne     @f
  190.         call    fun_opn_dlg
  191. @@:
  192.         cmp     ah,2          ; Start compiling
  193.         je      start
  194.         cmp     ah,3          ; Start compiled file
  195.         jnz     norunout
  196.        
  197.         mov     edx,outfile
  198.         call    make_fullpaths
  199.         mcall   70,file_info_start
  200. ;       xor     ecx,ecx
  201.         jmp     still
  202. ;---------------------------------------------------------------------
  203. norunout:
  204.         cmp     ah,4
  205.         jnz     norundebug
  206.        
  207.         mov     edx,outfile
  208.         call    make_fullpaths
  209.         mcall   70,file_info_debug
  210.         jmp     still
  211. ;---------------------------------------------------------------------
  212. norundebug:
  213.         jmp     still
  214. ;---------------------------------------------------------------------
  215. mouse:
  216.         push    dword edit1
  217.         call    [edit_box_mouse]
  218.         push    dword edit2
  219.         call    [edit_box_mouse]
  220.         push    dword edit3
  221.         call    [edit_box_mouse]
  222.         push    dword ch1_dbg
  223.         call    [check_box_mouse]
  224.         ret
  225. ;---------------------------------------------------------------------
  226. draw_window:
  227.         pusha
  228.         mcall   12,1 ; Start of draw
  229.        
  230.         get_sys_colors 1,0
  231.         edit_boxes_set_sys_color edit1,editboxes_end,sc
  232.         check_boxes_set_sys_color2 ch1_dbg,ch1_dbg+ch_struc_size,sc
  233.  
  234.         mov     edx,[sc.work]
  235.         or      edx,0x33000000
  236.         xor     eax,eax
  237.         xor     esi,esi
  238.         mcall   ,<100,280>,<90,260>,,,title            ; Draw Window Label Text
  239.  
  240.         mcall   9,PROCESSINFO,-1
  241.  
  242.         mov     eax,[PROCESSINFO+70] ;status of window
  243.         test    eax,100b
  244.         jne     .end
  245.  
  246.         cmp     dword[pinfo.box.width],230 ; ïðîâåðÿåì øèðèíó îêíà
  247.         jge     @f
  248.         mov     dword[pinfo.box.width],230 ; åñëè îêíî î÷åíü óçêîå, óâåëè÷èâàåì øèðèíó äëÿ èçáåæàíèÿ ãëþêîâ
  249. @@:
  250.         mpack   ecx,1,1
  251.         mov     ebx,[pinfo.box.width]
  252.         sub     ebx,10
  253.         mov     eax,8
  254.         mov     edx,0x4000000B
  255.         mpack   ebx,[pinfo.box.width],MAGIC1
  256.         msub    ebx,MAGIC1+10+1,0
  257.         mpack   ecx,0, (14*3+16)/3-1
  258.         madd    ecx,1,0
  259.         mcall   ,,,0x00000002,[sc.work_button]
  260.         madd    ecx, (14*3+16)/3+1,0
  261.         mcall   ,,,0x00000003
  262.         madd    ecx, (14*3+16)/3+1,0
  263.         mcall   ,,,4
  264. ;button for OpenDialog [..]
  265.         mov     ebx, 5*65536+47
  266.         mov     ecx, 33*65536+14
  267.         mcall   ,,,5
  268.  
  269.         mpack   ebx,6,0    ; Draw Window Text
  270.         add     ebx,1+ 14/2-3
  271.         mcall   4,,[sc.work_text],text,text.line_size   ;InFile
  272.  
  273.         add     ebx, 16 ;14
  274.         add     edx,text.line_size
  275.         mcall   ;OutFile
  276.  
  277.         mov     ecx,[sc.work_button_text]
  278.         add     ebx, 16 ;14
  279.         add     edx,text.line_size
  280.         mcall   ;Path
  281.  
  282.         mov     ebx,[pinfo.box.width]
  283.         sub     ebx,MAGIC1+10+1-9
  284.         shl     ebx,16
  285.         add     ebx,1+( (14*3+16)/3-1)/2-3
  286.         mcall   ,,[sc.work_button_text],s_compile,7
  287.         add     ebx,(14*3+16)/3+1
  288.         mcall   ,,,s_run
  289.         add     ebx,(14*3+16)/3+1
  290.         mcall   ,,,s_debug
  291.        
  292.         mpack   ebx,MAGIC1+6,0
  293.         add     ebx,1+ 14/2-3+ 14*0
  294.         mov     esi,[pinfo.box.width]
  295.         sub     esi,MAGIC1*2+5*2+6+3
  296.         mov     eax,esi
  297.         mov     cl,6
  298.         div     cl
  299.         cmp     al,MAX_PATH
  300.         jbe     @f
  301.         mov     al,MAX_PATH
  302. @@:
  303.         movzx   esi,al
  304.  
  305.         call    draw_messages
  306.        
  307.         mov     eax,dword [pinfo.box.width]
  308.         sub     eax,127
  309.         mov     dword[edit1.width],eax ; óñòàíàâëèâàåì øèðèíó òåêñòîâûõ ïîëåé
  310.         mov     dword[edit2.width],eax
  311.         mov     dword[edit3.width],eax
  312.        
  313.         push    dword edit1
  314.         call    [edit_box_draw]
  315.         push    dword edit2
  316.         call    [edit_box_draw]
  317.         push    dword edit3
  318.         call    [edit_box_draw]
  319.         push    dword ch1_dbg
  320.         call    [check_box_draw]
  321. .end:  
  322.         mcall   12,2 ; End of Draw
  323.         popa
  324.         ret
  325. ;---------------------------------------------------------------------
  326. bottom_right dd ?
  327.  
  328. align 4
  329. fun_opn_dlg: ;äã­ªæ¨ï ¤«ï ¢ë§®¢  OpenFile ¤¨ «®£ 
  330.         pushad
  331.         copy_path open_dialog_name,communication_area_default_path,library_path,0
  332.         mov     [OpenDialog_data.type],0
  333.  
  334.         xor     al,al
  335.         mov     edi,dword [edit3.text]
  336.         mov     ecx,dword [edit3.max]
  337.         cld
  338.         repne   scasb
  339.         cmp     byte[edi-2],'/'
  340.         jne     @f
  341.         mov     byte[edi-2],0 ;¥á«¨ ¢ ª®­æ¥ ¯ã⨠¥áâì á«¥è, â® ¯ãâì 㪮à ç¨¢ ¥¬ ­  1 ᨬ¢®«
  342. @@:
  343.         push    dword OpenDialog_data
  344.         call    dword [OpenDialog_Start]
  345.         cmp     [OpenDialog_data.status],2
  346.         je      @f
  347.  
  348.         xor     al,al
  349.         mov     edi,dword [edit3.text]
  350.         mov     ebx,edi ;copy text pointer
  351.         mov     ecx,dword [edit3.max]
  352.         cld
  353.         repne   scasb
  354.         cmp     byte[edi-2],'/'
  355.         jne     .no_slash
  356.        
  357.         dec     edi ;¥á«¨ ¢ ª®­æ¥ ¯ã⨠¥áâì á«¥è, â® ¯ãâì 㪮à ç¨¢ ¥¬ ­  1 ᨬ¢®«
  358. .no_slash:
  359.         mov     byte[edi-1],'/' ;áâ ¢¨¬ ¢ ª®­æ¥ ¯ã⨠᫥è
  360.         mov     byte[edi],0 ;®â१ ¥¬ ¨¬ï ­ ©¤¥­­®£® ä ©« 
  361.         sub     edi,ebx ;edi = strlen(edit3.text)
  362.         mov     [edit3.size],edi
  363.         mov     [edit3.pos],edi
  364.  
  365.         push    dword [OpenDialog_data.filename_area]
  366.         push    dword edit1
  367.         call    dword [edit_box_set_text]
  368.  
  369.         push    dword [OpenDialog_data.filename_area]
  370.         push    dword edit2
  371.         call    dword [edit_box_set_text]
  372.  
  373.         mov     esi,[edit2.text]
  374.         xor     eax,eax
  375.         cld
  376. .cycle:
  377.         lodsb
  378.         test    eax,eax
  379.         jnz     .cycle
  380.  
  381.         sub     esi,5
  382.         cmp     esi,[edit2.text]
  383.         jle     .short_fn
  384.        
  385.         mov     byte[esi],0
  386.         sub     dword [edit2.size],4
  387.         sub     dword [edit2.pos],4
  388.  
  389. .short_fn:
  390.         push    dword edit1
  391.         call    dword [edit_box_draw]
  392.         push    dword edit2
  393.         call    dword [edit_box_draw]
  394.         push    dword edit3
  395.         call    dword [edit_box_draw]
  396. @@:
  397.         popad
  398.         ret
  399. ;---------------------------------------------------------------------
  400. draw_messages:
  401.         mpack   ebx,7-2,[pinfo.box.width]
  402.         sub     ebx,5*2+7*2-1-2*2
  403.         mpack   ecx,0,[pinfo.box.height]
  404.         madd    ecx, 14*3+16+1+7+1,-( 14*3+16+1+7*2+25)
  405.         mov     word[bottom_right+2],bx
  406.         mov     word[bottom_right],cx
  407.         msub    [bottom_right],7,11
  408.         add     [bottom_right],7 shl 16 + 53
  409.         mcall   13,,,[sc.work]  ; clear work area
  410. _cy = 0
  411. _sy = 2
  412. _cx = 4
  413. _sx = 6
  414.         push    ebx ecx
  415.         mpack   ebx,4,5
  416.         add     bx,[esp+_cx]
  417.         mov     ecx,[esp+_sy-2]
  418.         mov     cx,[esp+_sy]
  419.         msub    ecx,1,1
  420.         mcall   38,,,[sc.work_graph]
  421.         mov     si,[esp+_cy]
  422.         add     cx,si
  423.         shl     esi,16
  424.         add     ecx,esi
  425.         madd    ecx,1,1
  426.         mcall
  427.         mpack   ebx,4,4
  428.         mov     esi,[esp+_sy-2]
  429.         mov     si,cx
  430.         mov     ecx,esi
  431.         mcall
  432.         mov     si,[esp+_cx]
  433.         add     bx,si
  434.         shl     esi,16
  435.         add     ebx,esi
  436.         madd    ebx,1,1
  437.         mcall
  438.         pop     ecx ebx
  439.         ret
  440. ;---------------------------------------------------------------------
  441. ; DATA
  442. ;---------------------------------------------------------------------
  443. if lang eq ru
  444. text:
  445.   db ' ‚å” ©«:'
  446. .line_size = $-text
  447.   db '‚ë唠©«:'
  448.   db '   ãâì:'
  449.   ;db 'x'
  450.  
  451.   s_compile db 'Š®¬¯¨«.'
  452.   s_run     db ' ã᪠ '
  453.   s_debug   db 'Žâ« ¤ª '
  454.   s_dbgdescr db '‘®§¤ ¢ âì ®â« ¤®ç­ãî ¨­ä®à¬ æ¨î',0
  455.  
  456.  
  457.   err_message_found_lib0 db '¥ ­ ©¤¥­  ¡¨¡«¨®â¥ª  box_lib.obj',0  ;áâப , ª®â®à ï ¡ã¤¥â ¢ áä®à¬¨à®¢ ­­®¬ ®ª­¥, ¥á«¨ ¡¨¡«¨®â¥ª  ­¥ ¡ã¤¥â ­ ©¤¥­ 
  458.   err_message_import0 db 'Žè¨¡ª  ¯à¨ ¨¬¯®à⥠¡¨¡«¨®â¥ª¨ box_lib.obj',0
  459.   err_message_found_lib1 db '¥ ­ ©¤¥­  ¡¨¡«¨®â¥ª  proc_lib.obj',0
  460.   err_message_import1 db 'Žè¨¡ª  ¯à¨ ¨¬¯®à⥠¡¨¡«¨®â¥ª¨ proc_lib.obj',0
  461.   head_f_i:
  462.   head_f_l db '‘¨á⥬­ ï ®è¨¡ª ',0 ;§ £®«®¢®ª ®ª­ , ¯à¨ ¢®§­¨ª­®¢¥­¨¨ ®è¨¡ª¨
  463. else
  464. text:
  465.   db ' InFile:'
  466. .line_size = $-text
  467.   db 'OutFile:'
  468.   db '   Path:'
  469.   ;db 'x'
  470.  
  471.   s_compile db 'COMPILE'
  472.   s_run     db '  RUN  '
  473.   s_debug   db ' DEBUG '
  474.   s_dbgdescr db 'Generate debug information',0
  475.  
  476.  
  477.   err_message_found_lib0 db 'Sorry I cannot found library box_lib.obj',0
  478.   err_message_import0 db 'Error on load import library box_lib.obj',0
  479.   err_message_found_lib1 db 'Sorry I cannot found library proc_lib.obj',0
  480.   err_message_import1 db 'Error on load import library proc_lib.obj',0
  481.  
  482.   head_f_i:
  483.   head_f_l db 'System error',0 ;§ £®«®¢®ª ®ª­ , ¯à¨ ¢®§­¨ª­®¢¥­¨¨ ®è¨¡ª¨
  484. end if
  485.  
  486.   system_dir0 db '/sys/lib/'
  487.   lib0_name db 'box_lib.obj',0
  488.  
  489.   system_dir1 db '/sys/lib/'
  490.   lib1_name db 'proc_lib.obj',0
  491. ;---------------------------------------------------------------------
  492. align 4
  493. import_box_lib:
  494. edit_box_draw           dd aEdit_box_draw
  495. edit_box_key            dd aEdit_box_key
  496. edit_box_mouse          dd aEdit_box_mouse
  497. edit_box_set_text       dd aEdit_box_set_text
  498. ;version_ed             dd aVersion_ed
  499.  
  500. init_checkbox           dd aInit_checkbox
  501. check_box_draw          dd aCheck_box_draw
  502. check_box_mouse         dd aCheck_box_mouse
  503. ;version_ch             dd aVersion_ch
  504.  
  505.                         dd 0,0
  506.  
  507. aEdit_box_draw          db 'edit_box',0
  508. aEdit_box_key           db 'edit_box_key',0
  509. aEdit_box_mouse         db 'edit_box_mouse',0
  510. aEdit_box_set_text      db 'edit_box_set_text',0
  511. ;aVersion_ed            db 'version_ed',0
  512.  
  513. aInit_checkbox          db 'init_checkbox2',0
  514. aCheck_box_draw         db 'check_box_draw2',0
  515. aCheck_box_mouse        db 'check_box_mouse2',0
  516. ;aVersion_ch            db 'version_ch2',0
  517. ;---------------------------------------------------------------------
  518. align 4
  519. import_proc_lib:
  520. OpenDialog_Init         dd aOpenDialog_Init
  521. OpenDialog_Start        dd aOpenDialog_Start
  522.                         dd 0,0
  523. aOpenDialog_Init        db 'OpenDialog_init',0
  524. aOpenDialog_Start       db 'OpenDialog_start',0
  525. ;---------------------------------------------------------------------
  526. ;library structures
  527. l_libs_start:
  528.   lib0 l_libs lib0_name, cur_dir_path, library_path, system_dir0, err_message_found_lib0, head_f_l, import_box_lib, err_message_import0, head_f_i
  529.   lib1 l_libs lib1_name, cur_dir_path, library_path, system_dir1, err_message_found_lib1, head_f_l, import_proc_lib,err_message_import1, head_f_i
  530. load_lib_end:
  531.  
  532. edit1 edit_box 153, 56, 1, 0xffffff, 0xff, 0x80ff, 0, 0x8000, (outfile-infile-1), infile, mouse_dd, 0, 11,11
  533. edit2 edit_box 153, 56, 17, 0xffffff, 0xff, 0x80ff, 0, 0x8000,(path-outfile-1), outfile, mouse_dd, 0, 7,7
  534. edit3 edit_box 153, 56, 33, 0xffffff, 0xff, 0x80ff, 0, 0x8000,(path_end-path-1), path, mouse_dd, 0, 6,6
  535. editboxes_end:
  536. ch1_dbg check_box2 (5 shl 16)+12, (49 shl 16)+12, 6, 0xffffff, 0x80ff, 0, s_dbgdescr,ch_flag_bottom
  537. ;---------------------------------------------------------------------
  538. align 4
  539. OpenDialog_data:
  540. .type                   dd 0
  541. .procinfo               dd pinfo        ;+4
  542. .com_area_name          dd communication_area_name      ;+8
  543. .com_area               dd 0    ;+12
  544. .opendir_path           dd path ;+16
  545. .dir_default_path       dd default_dir ;+20
  546. .start_path             dd library_path ;+24 ¯ãâì ª ¤¨ «®£ã ®âªàëâ¨ï ä ©«®¢
  547. .draw_window            dd draw_window  ;+28
  548. .status                 dd 0    ;+32
  549. .openfile_path          dd path ;+36 ¯ãâì ª ®âªà뢠¥¬®¬ã ä ©«ã
  550. .filename_area          dd filename_area        ;+40
  551. .filter_area            dd Filter
  552. .x:
  553. .x_size                 dw 420 ;+48 ; Window X size
  554. .x_start                dw 10 ;+50 ; Window X position
  555. .y:
  556. .y_size                 dw 320 ;+52 ; Window y size
  557. .y_start                dw 10 ;+54 ; Window Y position
  558.  
  559. default_dir db '/rd/1',0 ;¤¨à¥ªâ®à¨ï ¯® 㬮«ç ­¨î
  560.  
  561. communication_area_name:
  562.         db 'FFFFFFFF_open_dialog',0
  563. open_dialog_name:
  564.         db 'opendial',0
  565. communication_area_default_path:
  566.         db '/rd/1/File managers/',0
  567.  
  568. Filter:
  569. dd Filter.end - Filter
  570. .1:
  571. db 'ASM',0
  572. .end:
  573. db 0
  574. ;---------------------------------------------------------------------
  575. mouse_dd dd 0 ;íóæíî äëÿ Shift-à â editbox
  576. ;---------------------------------------------------------------------
  577. infile    db 'example.asm'
  578.   times MAX_PATH-$+infile  db 0
  579. outfile db 'example'
  580.   times MAX_PATH-$+outfile db 0
  581. path    db '/rd/1//' ;OpenDialog ¯à¨ § ¯ã᪥ 㡨ࠥ⠯®á«¥¤­¨© á«¥è, ­® ¤¨ «®£ ¬®¦¥â ¨á¯®«ì§®¢ âìáï ­¥ ¢á¥£¤ , ¯®â®¬ã á«¥è  2
  582.   times MAX_PATH-$+path    db 0
  583. path_end:
  584. lf db 13,10,0
  585. ;---------------------------------------------------------------------
  586. mov_param_str:
  587.         cld
  588. @@:
  589.         lodsb
  590.         cmp     al,','
  591.         je      @f
  592.         stosb
  593.         test    al,al
  594.         jnz     @b
  595. @@:
  596.         xor     al,al
  597.         stosb
  598.         ret
  599. ;---------------------------------------------------------------------
  600. start:
  601.         cmp     [_mode],NORMAL_MODE
  602.         jne     @f
  603.         call    draw_messages
  604.         mov     [textxy],7 shl 16 + 70
  605. @@:
  606.         mov     esi,_logo
  607.         call    display_string
  608.  
  609. ;---------------------------------------------------------------------
  610. ;   Fasm native code
  611. ;---------------------------------------------------------------------
  612.         mov     [input_file],infile
  613.         mov     [output_file],outfile
  614.        
  615.         call    init_memory
  616.        
  617.         call    make_timestamp
  618.         mov     [start_time],eax
  619.        
  620.         call    preprocessor
  621.         call    parser
  622.         call    assembler
  623.         bt      dword[ch1_dbg.flags],1 ;cmp [bGenerateDebugInfo], 0
  624.         jae     @f                        ;jz @f
  625.         call    symbol_dump
  626. @@:
  627.         call    formatter
  628.        
  629.         call    display_user_messages
  630.         movzx   eax,[current_pass]
  631.         inc     eax
  632.         call    display_number
  633.         mov     esi,_passes_suffix
  634.         call    display_string
  635.         call    make_timestamp
  636.         sub     eax,[start_time]
  637.         xor     edx,edx
  638.         mov     ebx,100
  639.         div     ebx
  640.         or      eax,eax
  641.         jz      display_bytes_count
  642.         xor     edx,edx
  643.         mov     ebx,10
  644.         div     ebx
  645.         push    edx
  646.         call    display_number
  647.         mov     dl,'.'
  648.         call    display_character
  649.         pop     eax
  650.         call    display_number
  651.         mov     esi,_seconds_suffix
  652.         call    display_string
  653. display_bytes_count:
  654.         mov     eax,[written_size]
  655.         call    display_number
  656.         mov     esi,_bytes_suffix
  657.         call    display_string
  658.         xor     al,al
  659.        
  660.         cmp     [_run_outfile],0
  661.         je      @f
  662.         mov     edx,outfile
  663.         call    make_fullpaths
  664.         xor     ecx,ecx
  665.         mcall   70,file_info_start
  666. @@:
  667.         jmp     exit_program
  668. ;---------------------------------------------------------------------
  669. include 'system.inc'
  670. include 'version.inc'
  671. include 'errors.inc'
  672. include 'symbdump.inc'
  673. include 'preproce.inc'
  674. include 'parser.inc'
  675. include 'exprpars.inc'
  676. include 'assemble.inc'
  677. include 'exprcalc.inc'
  678. include 'formats.inc'
  679. include 'x86_64.inc'
  680. include 'avx.inc'
  681. include 'tables.inc'
  682. include 'messages.inc'
  683. ;---------------------------------------------------------------------
  684. title db appname,VERSION_STRING,0
  685.  
  686. _logo db 'flat assembler  version ',VERSION_STRING,13,10,0
  687.  
  688. _passes_suffix db ' passes, ',0
  689. _seconds_suffix db ' seconds, ',0
  690. _bytes_suffix db ' bytes.',13,10,0
  691.  
  692. _include db 'INCLUDE',0
  693.  
  694. _counter db 4,'0000'
  695.  
  696. _mode          dd NORMAL_MODE
  697. _run_outfile  dd 0
  698. ;bGenerateDebugInfo db 0
  699.  
  700. dbgWord         db '-d',0
  701.  
  702. sub_table:
  703. times $41 db $00
  704. times $1A db $20
  705. times $25 db $00
  706. times $10 db $20
  707. times $30 db $00
  708. times $10 db $50
  709. times $04 db $00,$01
  710. times $08 db $00
  711.  
  712. ;include_debug_strings
  713. program_end:
  714. ;  params db 0 ; 'TINYPAD.ASM,TINYPAD,/HD/1/TPAD4/',
  715. params  rb 4096
  716. cur_dir_path rb 4096
  717. library_path rb 4096
  718. filename_area rb 256
  719.  
  720. align 4
  721.  
  722. include 'variable.inc'
  723.  
  724. program_base dd ?
  725. buffer_address dd ?
  726. memory_setting dd ?
  727. start_time dd ?
  728. memblock        dd      ?
  729.  
  730. predefinitions rb 1000h
  731.  
  732. dbgfilename     rb      MAX_PATH+4
  733.  
  734. sc    system_colors
  735. max_handles = 8
  736. fileinfos rb (4+20+MAX_PATH)*max_handles
  737. fileinfos_end:
  738. pinfo process_information
  739.  
  740. align 1000h
  741. rb 1000h
  742. stacktop:
  743.