Subversion Repositories Kolibri OS

Rev

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