Subversion Repositories Kolibri OS

Rev

Rev 9460 | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed

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