Subversion Repositories Kolibri OS

Rev

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