Subversion Repositories Kolibri OS

Rev

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