Subversion Repositories Kolibri OS

Rev

Rev 7986 | Rev 8090 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed

  1. use32
  2.         org 0
  3.         db 'MENUET01'
  4.         dd 1,start,i_end,mem,stacktop,openfile_path,sys_path
  5.  
  6. include 'lang.inc'
  7. include '../../../programs/macros.inc'
  8. include '../../../programs/proc32.inc'
  9. include '../../../programs/KOSfuncs.inc'
  10. include '../../../programs/load_img.inc'
  11. include '../../../programs/develop/libraries/TinyGL/asm_fork/opengl_const.inc'
  12. include '../../../programs/develop/libraries/libs-dev/libimg/libimg.inc'
  13. include '../../../programs/develop/info3ds/info_fun_float.inc'
  14.  
  15. @use_library_mem mem.Alloc,mem.Free,mem.ReAlloc,dll.Load
  16. caption db 'Image transform 10.06.20',0 ;¯®¤¯¨áì ®ª­ 
  17.  
  18. offs_zbuf_pbuf equ 24 ;const. from 'zbuffer.inc'
  19.  
  20. BUF_STRUCT_SIZE equ 21
  21. buf2d_data equ dword[edi] ;¤ ­­ë¥ ¡ãä¥à  ¨§®¡à ¦¥­¨ï
  22. buf2d_w equ dword[edi+8] ;è¨à¨­  ¡ãä¥à 
  23. buf2d_h equ dword[edi+12] ;¢ëá®â  ¡ãä¥à 
  24. buf2d_l equ word[edi+4]
  25. buf2d_t equ word[edi+6] ;®âáâ㯠ᢥàåã
  26. buf2d_size_lt equ dword[edi+4] ;®âáâ㯠᫥¢  ¨ á¯à ¢  ¤«ï ¡ãä¥à 
  27. buf2d_color equ dword[edi+16] ;梥â ä®­  ¡ãä¥à 
  28. buf2d_bits equ byte[edi+20] ;ª®«¨ç¥á⢮ ¡¨â ¢ 1-© â®çª¥ ¨§®¡à ¦¥­¨ï
  29.  
  30. NAV_WND_L equ 145
  31. NAV_WND_T equ 1
  32.  
  33. include 'select_points.inc'
  34.  
  35. IMAGE_TOOLBAR_ICON_SIZE equ 16*16*3
  36. image_data_toolbar dd 0
  37.  
  38. align 4
  39. start:
  40.         load_libraries l_libs_start,l_libs_end
  41.         ;¯à®¢¥àª  ­  ᪮«ìª® 㤠筮 § £ã§¨« áì ¡¨¡«¨®â¥ª 
  42.         mov     ebp,lib_0
  43.         cmp     dword [ebp+ll_struc_size-4],0
  44.         jz      @f
  45.                 mcall SF_TERMINATE_PROCESS
  46.         @@:
  47.         mcall SF_STYLE_SETTINGS,SSF_GET_COLORS,sc,sizeof.system_colors
  48.         mcall SF_SET_EVENTS_MASK,0xC0000027
  49.         stdcall [OpenDialog_Init],OpenDialog_data ;¯®¤£®â®¢ª  ¤¨ «®£ 
  50.  
  51.         stdcall [buf2d_create], buf_0 ;ᮧ¤ ­¨¥ ¡ãä¥à 
  52.  
  53.         include_image_file '../../../programs/fs/kfar/trunk/font6x9.bmp', image_data_toolbar, buf_font.w,buf_font.h
  54.         stdcall [buf2d_create_f_img], buf_font,[image_data_toolbar] ;ᮧ¤ ¥¬ ¡ãä¥à
  55.         stdcall mem.Free,[image_data_toolbar] ;®á¢®¡®¦¤ ¥¬ ¯ ¬ïâì
  56.         stdcall [buf2d_conv_24_to_8], buf_font,1 ;¤¥« ¥¬ ¡ãä¥à ¯à®§à ç­®á⨠8 ¡¨â
  57.         stdcall [buf2d_convert_text_matrix], buf_font
  58.  
  59.         include_image_file 'toolbar.png', image_data_toolbar
  60.  
  61.         mcall SF_SYSTEM_GET,SSF_TIME_COUNT
  62.         mov [last_time],eax
  63.  
  64.         ;­ áâனª  â®ç¥ª
  65.         call points_init
  66.  
  67.         ;open file from cmd line
  68.         cmp dword[openfile_path],0
  69.         je @f
  70.                 call but_open_file.no_dlg
  71.         @@:
  72.  
  73. align 4
  74. red_win:
  75.         call draw_window
  76.  
  77. align 16
  78. still:
  79.         mcall SF_SYSTEM_GET,SSF_TIME_COUNT
  80.         mov ebx,[last_time]
  81.         add ebx,10 ;§ ¤¥à¦ª 
  82.         cmp ebx,eax
  83.         jge @f
  84.                 mov ebx,eax
  85.         @@:
  86.         sub ebx,eax
  87.         mcall SF_WAIT_EVENT_TIMEOUT
  88.         cmp eax,0
  89.         je timer_funct
  90.  
  91.         cmp al,1
  92.         jz red_win
  93.         cmp al,2
  94.         jz key
  95.         cmp al,3
  96.         jz button
  97.         cmp al,6
  98.         jne @f
  99.                 mcall SF_THREAD_INFO,procinfo,-1
  100.                 cmp ax,word[procinfo.window_stack_position]
  101.                 jne @f ;®ª­® ­¥  ªâ¨¢­®
  102.                 call mouse
  103.         @@:
  104.         jmp still
  105.  
  106. align 4
  107. timer_funct:
  108.         push eax ebx
  109.                 mcall SF_SYSTEM_GET,SSF_TIME_COUNT
  110.                 mov [last_time],eax
  111.         pop ebx eax
  112.         cmp byte[calc],0
  113.         je still
  114.                 call draw_nav_wnd
  115.                 call draw_buffers
  116.         jmp still
  117.  
  118. align 16
  119. draw_window:
  120. pushad
  121.         mcall SF_REDRAW,SSF_BEGIN_DRAW
  122.  
  123.         ; *** à¨á®¢ ­¨¥ £« ¢­®£® ®ª­  (¢ë¯®«­ï¥âáï 1 à § ¯à¨ § ¯ã᪥) ***
  124.         mov edx,[sc.work]
  125.         or  edx,(3 shl 24)+0x30000000
  126.         mcall SF_CREATE_WINDOW,(20 shl 16)+410,(20 shl 16)+520,,,caption
  127.  
  128.         mcall SF_THREAD_INFO,procinfo,-1
  129.         mov eax,dword[procinfo.box.height]
  130.         cmp eax,120
  131.         jge @f
  132.                 mov eax,120 ;min size
  133.         @@:
  134.         sub eax,65
  135.         mov ebx,dword[procinfo.box.width]
  136.         cmp ebx,270
  137.         jge @f
  138.                 mov ebx,270
  139.         @@:
  140.         sub ebx,19
  141.         cmp eax,dword[buf_0.h] ;ᬮâਬ à §¬¥à ¡ãä¥à 
  142.         jne @f
  143.         cmp ebx,dword[buf_0.w]
  144.         jne @f
  145.                 jmp .end0
  146.         @@:
  147.                 stdcall [buf2d_resize],buf_0,ebx,eax,1
  148.                 call calc_nav_params
  149.                 mov eax,[nav_x]
  150.                 call nav_x_corect
  151.                 mov [nav_x],eax
  152.                 mov eax,[nav_y]
  153.                 call nav_y_corect
  154.                 mov [nav_y],eax
  155.                 mov byte[calc],1
  156.         .end0:
  157.  
  158.         ; *** ᮧ¤ ­¨¥ ª­®¯®ª ­  ¯ ­¥«ì ***
  159.         mcall SF_DEFINE_BUTTON,(5 shl 16)+20,(5 shl 16)+20,3, [sc.work_button]
  160.  
  161.         add ebx,25 shl 16
  162.         mcall ,,,4
  163.         add ebx,30 shl 16
  164.         mcall ,,,5
  165.         add ebx,25 shl 16
  166.         mcall ,,,6
  167.         add ebx,25 shl 16
  168.         mcall ,,,7
  169.  
  170.         ; *** à¨á®¢ ­¨¥ ¨ª®­®ª ­  ª­®¯ª å ***
  171.         mov edx,(7 shl 16)+7 ;icon open
  172.         mcall SF_PUT_IMAGE,[image_data_toolbar],(16 shl 16)+16
  173.  
  174.         add ebx,IMAGE_TOOLBAR_ICON_SIZE
  175.         add edx,(25 shl 16) ;icon save
  176.         int 0x40
  177.         add ebx,IMAGE_TOOLBAR_ICON_SIZE
  178.         add edx,(30 shl 16) ;icon view
  179.         int 0x40
  180.         add ebx,IMAGE_TOOLBAR_ICON_SIZE
  181.         add edx,(25 shl 16) ;icon mode
  182.         int 0x40
  183.         add ebx,IMAGE_TOOLBAR_ICON_SIZE
  184.         add edx,(25 shl 16) ;
  185.         int 0x40
  186.  
  187.         call draw_nav_wnd
  188.         call draw_buffers
  189.  
  190.         mcall SF_REDRAW,SSF_END_DRAW
  191. popad
  192.         ret
  193.  
  194. ;à¨á®¢ ­¨¥ ­ ¢¨£ æ¨®­­®£® ®ª­ 
  195. align 4
  196. proc draw_nav_wnd
  197.         cmp dword[buf_i0],0
  198.         je .end0
  199.         bt dword[nav_x_min],31
  200.         jnc .end0
  201.         bt dword[nav_y_min],31
  202.         jnc .end0
  203. pushad
  204.                 mov ebx,(NAV_WND_L shl 16)
  205.                 add ebx,[nav_wnd_w]
  206.                 mov ecx,(NAV_WND_T shl 16)
  207.                 add ecx,[nav_wnd_h]
  208.                 mcall SF_DRAW_RECT,,,0 ;¨§®¡à ¦¥­¨¥
  209.                 mov ecx,[nav_wnd_zoom]
  210.                 mov ebx,[nav_x]
  211.                 neg ebx
  212.                 sar ebx,cl
  213.                 add ebx,NAV_WND_L
  214.                 shl ebx,16
  215.                 add ebx,[buf_0.w]
  216.                 shr bx,cl
  217.                 mov edx,[nav_y]
  218.                 neg edx
  219.                 sar edx,cl
  220.                 add edx,NAV_WND_T
  221.                 shl edx,16
  222.                 add edx,[buf_0.h]
  223.                 shr dx,cl
  224.                 mov ecx,edx
  225.                 mcall ,,,0x404080 ;ç áâì ¨§®¡à ¦¥­¨ï ¯®¯ ¤ îé ï ¢ ®ª­®
  226.                
  227.                 mov edi,sel_pt
  228.                 @@:
  229.                         mov ecx,[nav_wnd_zoom]
  230.                         mov ebx,[edi+point2d.x]
  231.                         shr ebx,cl
  232.                         add ebx,NAV_WND_L
  233.                         mov edx,[edi+point2d.y]
  234.                         shr edx,cl
  235.                         add edx,NAV_WND_T
  236.                         mov ecx,edx
  237.                         mcall SF_PUT_PIXEL,,,0xffff00
  238.                         add edi,sizeof.point2d
  239.                         cmp edi,sel_pt+4*sizeof.point2d
  240.                         jl @b
  241. popad
  242.         .end0:
  243.         ret
  244. endp
  245.  
  246. align 4
  247. proc draw_buffers
  248. pushad
  249.         cmp byte[calc],0
  250.         je .end0
  251.                 ; *** ®¡­®¢«¥­¨¥ ¡ãä¥à  ***
  252.                 bt dword[nav_x_min],31
  253.                 jnc .beg0
  254.                 bt dword[nav_y_min],31
  255.                 jc @f
  256.                 .beg0:
  257.                         stdcall [buf2d_clear], buf_0, [buf_0.color] ;ç¨á⨬ ¡ãä¥à
  258.                 @@:
  259.                 cmp byte[view_b],1
  260.                 je .end1
  261.                         push buf_i0
  262.                         jmp .end2
  263.                 .end1:
  264.                         push buf_ogl
  265.                 .end2:
  266.                 stdcall [buf2d_bit_blt], buf_0, [nav_x],[nav_y] ;,...
  267.  
  268.                 call points_draw
  269.  
  270.                 ; *** ®¡­®¢«¥­¨¥ ¯®¤¯¨á¨ à §¬¥à  ä ©«  ***
  271.                 mov edi,txt_f_size.size
  272.                 mov eax,[open_file_size]
  273.                 mov ebx,txt_pref
  274.                 .cycle:
  275.                         cmp eax,1024
  276.                         jl @f
  277.                         shr eax,10
  278.                         add ebx,4
  279.                         jmp .cycle
  280.                 @@:
  281.                 stdcall convert_int_to_str, 16
  282.                 stdcall str_cat, edi,ebx
  283.                 stdcall str_cat, edi,txt_space ;§ ¢¥àè î騩 ¯à®¡¥«
  284.                 ;è¨à¨­  ¨ ¢ëá®â  ¨§®¡à ¦¥­¨ï
  285.                 mov eax,[buf_i0.w]
  286.                 mov edi,txt_img_w.size
  287.                 stdcall convert_int_to_str, 16
  288.                 mov eax,[buf_i0.h]
  289.                 mov edi,txt_img_h.size
  290.                 stdcall convert_int_to_str, 16
  291.                 mov byte[calc],0
  292.         .end0:
  293.         ; *** à¨á®¢ ­¨¥ ¡ãä¥à  ***
  294.         stdcall [buf2d_draw], buf_0
  295.         ; *** à¨á®¢ ­¨¥ ¯®¤¯¨á¨ à §¬¥à  ä ©«  ***
  296.         mov ecx,[sc.work_text]
  297.         or  ecx,0x80000000 or (1 shl 30)
  298.         mov edi,[sc.work] ;梥â ä®­  ®ª­ 
  299.         mcall SF_DRAW_TEXT,(275 shl 16)+4,,txt_f_size
  300.         add ebx,9
  301.         mcall ,,,txt_img_w
  302.         add ebx,9
  303.         mcall ,,,txt_img_h
  304. popad
  305.         ret
  306. endp
  307.  
  308. align 16
  309. key:
  310.         push eax ebx ecx
  311.         mcall SF_GET_KEY
  312.         cmp byte[view_b],1
  313.         je .end1
  314.         cmp ah,49 ;1
  315.         jne @f
  316.                 mov edi,sel_pt
  317.                 call set_point_coords
  318.                 jmp .end0
  319.         @@:
  320.         cmp ah,50 ;2
  321.         jne @f
  322.                 mov edi,sel_pt+sizeof.point2d
  323.                 call set_point_coords
  324.                 jmp .end0
  325.         @@:
  326.         cmp ah,51 ;3
  327.         jne @f
  328.                 mov edi,sel_pt+sizeof.point2d*2
  329.                 call set_point_coords
  330.                 jmp .end0
  331.         @@:
  332.         cmp ah,52 ;4
  333.         jne @f
  334.                 mov edi,sel_pt+sizeof.point2d*3
  335.                 call set_point_coords
  336.                 jmp .end0
  337.         @@:
  338.         .end1:
  339.  
  340.         cmp ah,178 ;Up
  341.         jne @f
  342.                 call but_img_move_up
  343.                 jmp .end0
  344.         @@:
  345.         cmp ah,177 ;Down
  346.         jne @f
  347.                 call but_img_move_down
  348.                 jmp .end0
  349.         @@:
  350.         cmp ah,176 ;Left
  351.         jne @f
  352.                 call but_img_move_left
  353.                 jmp .end0
  354.         @@:
  355.         cmp ah,179 ;Right
  356.         jne @f
  357.                 call but_img_move_right
  358.                 jmp .end0
  359.         @@:
  360.  
  361.         mov ecx,eax
  362.         mcall SF_KEYBOARD,SSF_GET_CONTROL_KEYS
  363.         bt eax,2 ;left Ctrl
  364.         jc .key_Ctrl
  365.         bt eax,3 ;right Ctrl
  366.         jc .key_Ctrl
  367.         jmp .end0
  368.         .key_Ctrl:
  369.                 cmp ch,15 ;Ctrl+O
  370.                 jne @f
  371.                         call but_open_file
  372.                 @@:
  373.                 cmp ch,19 ;Ctrl+S
  374.                 jne @f
  375.                         call but_save_file
  376.                 @@:
  377.  
  378.         .end0:
  379.         pop ecx ebx eax
  380.         jmp still
  381.  
  382. ;input:
  383. ; edi - 㪠§ â¥«ì ­  áâàãªâãàã point2d
  384. align 4
  385. set_point_coords:
  386.         call buf_get_mouse_coord
  387.         cmp eax,-1
  388.         je .end0
  389.                 sub eax,[nav_x]
  390.                 cmp eax,0
  391.                 jge @f
  392.                         xor eax,eax
  393.                 @@:
  394.                 cmp eax,[buf_i0.w]
  395.                 jle @f
  396.                         mov eax,[buf_i0.w]
  397.                 @@:
  398.                 mov [edi+point2d.x],eax
  399.                 sub ebx,[nav_y]
  400.                 cmp ebx,0
  401.                 jge @f
  402.                         xor ebx,ebx
  403.                 @@:
  404.                 cmp ebx,[buf_i0.h]
  405.                 jle @f
  406.                         mov ebx,[buf_i0.h]
  407.                 @@:
  408.                 mov [edi+point2d.y],ebx
  409.                 call points_update_prop
  410.                 mov byte[calc],1
  411.         .end0:
  412.         ret
  413.  
  414. align 16
  415. button:
  416.         mcall SF_GET_BUTTON
  417.         cmp ah,3
  418.         jne @f
  419.                 call but_open_file
  420.                 jmp still
  421.         @@:
  422.         cmp ah,4
  423.         jne @f
  424.                 call but_save_file
  425.                 jmp still
  426.         @@:
  427.         cmp ah,5
  428.         jne @f
  429.                 call but_2
  430.                 jmp still
  431.         @@:
  432.         cmp ah,6
  433.         jne @f
  434.                 call but_3
  435.                 jmp still
  436.         @@:
  437.         cmp ah,7
  438.         jne @f
  439.                 call but_about
  440.                 jmp still
  441.         @@:
  442.         cmp ah,1
  443.         jne still
  444. .exit:
  445.         stdcall [buf2d_delete],buf_0
  446.         stdcall [buf2d_delete],buf_i0
  447.         ;stdcall [buf2d_delete],buf_ogl
  448.         stdcall mem.Free,[image_data_toolbar]
  449.         stdcall mem.Free,[open_file_img]
  450.         mcall SF_TERMINATE_PROCESS
  451.  
  452. align 4
  453. mouse:
  454.         push eax ebx ecx
  455.         mcall SF_MOUSE_GET,SSF_BUTTON_EXT
  456.         bt eax,8
  457.         jnc @f
  458.                 ;mouse l. but. press
  459.                 call mouse_left_d
  460.                 jmp .end_l
  461.         @@:
  462.         ;bt eax,0
  463.         ;jnc @f
  464.                 ;mouse l. but. move
  465.                 ;call mouse_left_m
  466.                 ;jmp .end_l
  467.         ;@@:
  468.         bt eax,16
  469.         jnc .end_l
  470.                 ;mouse l. but. up
  471.                 call mouse_left_u
  472.                 ;jmp .end_l
  473.         .end_l:
  474.         ;bt eax,9
  475.         ;jnc @f
  476.                 ;mouse r. but. press
  477.                 ;call mouse_right_d
  478.                 ;jmp .end_r
  479.         ;@@:
  480.         ;bt eax,1
  481.         ;jnc @f
  482.                 ;mouse r. but. move
  483.                 ;call mouse_right_m
  484.                 ;jmp .end_r
  485.         ;@@:
  486.         ;.end_r:
  487.  
  488.         pop ecx ebx eax
  489.         ret
  490.  
  491. ;output:
  492. ; eax - buffer coord X (¥á«¨ ªãàá®à §  ¡ãä¥à®¬ -1)
  493. ; ebx - buffer coord Y (¥á«¨ ªãàá®à §  ¡ãä¥à®¬ -1)
  494. align 4
  495. proc buf_get_mouse_coord
  496.         mcall SF_MOUSE_GET,SSF_WINDOW_POSITION
  497.         cmp ax,word[buf_0.t]
  498.         jl .no_buf ;­¥ ¯®¯ «¨ ¢ ®ª­® ¡ãä¥à  ¯® ®á¨ y
  499.         mov ebx,eax
  500.         shr ebx,16
  501.         cmp bx,word[buf_0.l]
  502.         jl .no_buf ;­¥ ¯®¯ «¨ ¢ ®ª­® ¡ãä¥à  ¯® ®á¨ x
  503.  
  504.         and eax,0xffff ;®áâ ¢«ï¥¬ ª®®à¤¨­ âã y
  505.         sub ax,word[buf_0.t]
  506.         cmp eax,[buf_0.h]
  507.         jg .no_buf
  508.         sub bx,word[buf_0.l]
  509.         cmp ebx,[buf_0.w]
  510.         jg .no_buf
  511.         xchg eax,ebx
  512.         jmp .end_f
  513.         .no_buf:
  514.                 xor eax,eax
  515.                 not eax
  516.                 xor ebx,ebx
  517.                 not ebx
  518.         .end_f:
  519.         ret
  520. endp
  521.  
  522. ;output:
  523. ; eax - buffer coord X (¥á«¨ ªãàá®à §  ¡ãä¥à®¬ -1)
  524. ; ebx - buffer coord Y (¥á«¨ ªãàá®à §  ¡ãä¥à®¬ -1)
  525. align 4
  526. proc nav_wnd_get_mouse_coord
  527.         mcall SF_MOUSE_GET,SSF_WINDOW_POSITION
  528.         cmp ax,NAV_WND_T
  529.         jl .no_buf ;­¥ ¯®¯ «¨ ¢ ®ª­® ¡ãä¥à  ¯® ®á¨ y
  530.         cmp eax,NAV_WND_L shl 16
  531.         jl .no_buf ;­¥ ¯®¯ «¨ ¢ ®ª­® ¡ãä¥à  ¯® ®á¨ x
  532.         mov ebx,eax
  533.         shr ebx,16
  534.  
  535.         and eax,0xffff ;®áâ ¢«ï¥¬ ª®®à¤¨­ âã y
  536.         sub ax,NAV_WND_T
  537.         cmp eax,[nav_wnd_h]
  538.         jg .no_buf
  539.         sub bx,NAV_WND_L
  540.         cmp ebx,[nav_wnd_w]
  541.         jg .no_buf
  542.         xchg eax,ebx
  543.         jmp .end_f
  544.         .no_buf:
  545.                 xor eax,eax
  546.                 not eax
  547.                 xor ebx,ebx
  548.                 not ebx
  549.         .end_f:
  550.         ret
  551. endp
  552.  
  553. align 4
  554. mouse_left_d:
  555. pushad
  556.         call buf_get_mouse_coord
  557.         cmp eax,-1
  558.         je .end0
  559.                 mov [mouse_down_x],eax
  560.                 mov [mouse_down_y],ebx
  561.                 sub eax,[nav_x]
  562.                 sub ebx,[nav_y]
  563.                
  564.                 mov edi,sel_pt
  565.                 xor ecx,ecx
  566.                 .cycle0:
  567.                         mov edx,[edi+point2d.x]
  568.                         sub edx,eax
  569.                         bt edx,31
  570.                         jnc @f
  571.                                 neg edx
  572.                         @@:
  573.                         cmp edx,5 ;à §¬¥à ¤«ï ¢ë¤¥«¥­¨ï â®çª¨ ¯® ®á¨ x
  574.                         jg .end1
  575.                         mov edx,[edi+point2d.y]
  576.                         sub edx,ebx
  577.                         bt edx,31
  578.                         jnc @f
  579.                                 neg edx
  580.                         @@:
  581.                         cmp edx,5 ;à §¬¥à ¤«ï ¢ë¤¥«¥­¨ï â®çª¨ ¯® ®á¨ y
  582.                         jg .end1
  583.                                 mov [sel_act],ecx
  584.                                 jmp .end0
  585.                         .end1:
  586.                         add edi,sizeof.point2d
  587.                         inc ecx
  588.                         cmp ecx,4
  589.                         jl .cycle0
  590.                         mov dword[sel_act],-1
  591.                 jmp .end2
  592.         .end0:
  593.         call nav_wnd_get_mouse_coord
  594.         cmp eax,-1
  595.         je .end2
  596.                 mov ecx,[nav_wnd_zoom]
  597.                 shl eax,cl
  598.                 shl ebx,cl
  599.                 stdcall nav_to_point, eax,ebx
  600.                 mov byte[calc],1
  601.         .end2:
  602. popad
  603.         ret
  604.  
  605. align 4
  606. proc mouse_left_u uses eax ebx
  607.         call buf_get_mouse_coord
  608.         cmp eax,-1
  609.         je .end0
  610.                 sub [mouse_down_x],eax
  611.                 sub [mouse_down_y],ebx
  612.  
  613.                 cmp dword[sel_act],-1
  614.                 je .end1
  615.                         ;¤¢¨£ ¥¬ â®çª¨
  616.                         mov eax,[sel_act]
  617.                         imul eax,sizeof.point2d
  618.                         add eax,sel_pt
  619.                         ;coord x
  620.                         mov ebx,dword[eax+point2d.x]
  621.                         sub ebx,[mouse_down_x]
  622.                         cmp ebx,0
  623.                         jge @f
  624.                                 xor ebx,ebx
  625.                         @@:
  626.                         cmp ebx,[buf_i0.w]
  627.                         jle @f
  628.                                 mov ebx,[buf_i0.w]
  629.                         @@:
  630.                         mov dword[eax+point2d.x],ebx
  631.                         ;coord y
  632.                         mov ebx,dword[eax+point2d.y]
  633.                         sub ebx,[mouse_down_y]
  634.                         cmp ebx,0
  635.                         jge @f
  636.                                 xor ebx,ebx
  637.                         @@:
  638.                         cmp ebx,[buf_i0.h]
  639.                         jle @f
  640.                                 mov ebx,[buf_i0.h]
  641.                         @@:
  642.                         mov dword[eax+point2d.y],ebx
  643.                         call points_update_prop
  644.                         jmp .end2
  645.                 .end1:
  646.  
  647.                 ;¤¢¨£ ¥¬ ¨§®¡à ¦¥­¨¥
  648.                 mov eax,[nav_y]
  649.                 sub eax,[mouse_down_y]
  650.                 call nav_y_corect
  651.                 mov [nav_y],eax
  652.  
  653.                 mov eax,[nav_x]
  654.                 sub eax,[mouse_down_x]
  655.                 call nav_x_corect
  656.                 mov [nav_x],eax
  657.         .end2:
  658.                 mov byte[calc],1
  659.         .end0:
  660.         ret
  661. endp
  662.  
  663. align 4
  664. proc but_new_file uses eax edi esi
  665.         xor eax,eax
  666.         mov [open_file_size],eax
  667.         mov edi,[open_file_img]
  668.         stosd
  669.         ret
  670. endp
  671.  
  672. align 4
  673. open_file_img dd 0 ;㪠§ â¥«ì ­  ¯ ¬ïâì ¤«ï ®âªàëâ¨ï ⥪áâãà
  674. open_file_size dd 0 ;à §¬¥à
  675.  
  676. ;¢ëç¨á«¥­¨¥ ¯ à ¬¥â஢ ¤«ï ­ ¢¨£ æ¨¨ ¯® ¨§®¡à ¦¥­¨î
  677. align 4
  678. proc calc_nav_params uses eax ecx edi
  679.         mov dword[nav_x_max],0
  680.         mov edi,buf_0
  681.         mov eax,buf2d_w
  682.         mov [nav_sx],eax
  683.         mov edi,buf_i0
  684.         sub eax,buf2d_w
  685.         bt eax,31
  686.         jc @f
  687.                 mov [nav_x_max],eax
  688.                 xor eax,eax
  689.         @@:
  690.         mov [nav_x_min],eax
  691.         mov edi,buf2d_w
  692.         cmp [nav_sx],edi
  693.         jle @f
  694.                 mov [nav_sx],edi
  695.         @@:
  696.         shr dword[nav_sx],1
  697.  
  698.         mov dword[nav_y_max],0
  699.         mov edi,buf_0
  700.         mov eax,buf2d_h
  701.         mov [nav_sy],eax
  702.         mov edi,buf_i0
  703.         sub eax,buf2d_h
  704.         bt eax,31
  705.         jc @f
  706.                 mov [nav_y_max],eax
  707.                 xor eax,eax
  708.         @@:
  709.         mov [nav_y_min],eax
  710.         mov edi,buf2d_h
  711.         cmp [nav_sy],edi
  712.         jle @f
  713.                 mov [nav_sy],edi
  714.         @@:
  715.         shr dword[nav_sy],1
  716.  
  717.         xor ecx,ecx
  718.         mov eax,[buf_i0.w]
  719.         @@:
  720.                 inc ecx
  721.                 shr eax,1
  722.                 cmp eax,100
  723.                 jg @b
  724.         mov [nav_wnd_zoom],ecx
  725.         xor ecx,ecx
  726.         mov eax,[buf_i0.h]
  727.         @@:
  728.                 inc ecx
  729.                 shr eax,1
  730.                 cmp eax,32
  731.                 jg @b
  732.         cmp [nav_wnd_zoom],ecx
  733.         jg @f
  734.                 mov [nav_wnd_zoom],ecx
  735.         @@:
  736.         mov ecx,[nav_wnd_zoom]
  737.         mov eax,[buf_i0.w]
  738.         shr eax,cl
  739.         mov [nav_wnd_w],eax
  740.         mov eax,[buf_i0.h]
  741.         shr eax,cl
  742.         mov [nav_wnd_h],eax
  743.         ret
  744. endp
  745.  
  746. align 4
  747. proc but_open_file
  748.         copy_path open_dialog_name,communication_area_default_path,file_name,0
  749.         pushad
  750.         mov [OpenDialog_data.type],0
  751.         stdcall [OpenDialog_Start],OpenDialog_data
  752.         cmp [OpenDialog_data.status],2
  753.         je .end_open_file
  754.         jmp .end0
  755. .no_dlg: ;¥á«¨ ¬¨­ã¥¬ ¤¨ «®£ ®âªàëâ¨ï ä ©« 
  756.                 pushad
  757.                 mov esi,openfile_path
  758.                 stdcall str_len,esi
  759.                 add esi,eax
  760.                 @@: ;横« ¤«ï ¯®¨áª  ­ ç «  ¨¬¥­¨ ä ©« 
  761.                         dec esi
  762.                         cmp byte[esi],'/'
  763.                         je @f
  764.                         cmp byte[esi],0x5c ;'\'
  765.                         je @f
  766.                         cmp esi,openfile_path
  767.                         jg @b
  768.                 @@:
  769.                 inc esi
  770.                 stdcall [OpenDialog_Set_file_name],OpenDialog_data,esi ;ª®¯¨à㥬 ¨¬ï ä ©«  ¢ ¤¨ «®£ á®åà ­¥­¨ï
  771.         .end0:
  772.  
  773.         mov [run_file_70.Function], SSF_GET_INFO
  774.         mov [run_file_70.Position], 0
  775.         mov [run_file_70.Flags], 0
  776.         mov dword[run_file_70.Count], 0
  777.         mov dword[run_file_70.Buffer], open_b
  778.         mov byte[run_file_70+20], 0
  779.         mov dword[run_file_70.FileName], openfile_path
  780.         mcall SF_FILE,run_file_70
  781.  
  782.         mov ecx,dword[open_b+32] ;+32 qword: à §¬¥à ä ©«  ¢ ¡ ©â å
  783.         mov [open_file_size],ecx
  784.         stdcall mem.ReAlloc,[open_file_img],ecx ;¢ë¤¥«ï¥¬ ¯ ¬ïâì ¤«ï ¨§®¡à ¦¥­¨ï
  785.         mov [open_file_img],eax
  786.  
  787.         mov [run_file_70.Function], SSF_READ_FILE
  788.         mov [run_file_70.Position], 0
  789.         mov [run_file_70.Flags], 0
  790.         m2m [run_file_70.Count], dword[open_file_size]
  791.         m2m [run_file_70.Buffer],dword[open_file_img]
  792.         mov byte[run_file_70+20], 0
  793.         mov [run_file_70.FileName], openfile_path
  794.         mcall SF_FILE,run_file_70
  795.         cmp ebx,0xffffffff
  796.         je .end_0
  797.                 ;®¯à¥¤¥«ï¥¬ ¢¨¤ ¨§®¡à ¦¥­¨ï
  798.                 stdcall [img_decode], [open_file_img],ebx,0
  799.                 or eax,eax
  800.                 jz .end_0 ;¥á«¨ ­ àã襭 ä®à¬ â ä ©« 
  801.                 mov ebx,eax
  802.                
  803.                 mov ecx,[ebx+4] ;+4 = image width
  804.                 mov dword[buf_cop.w],ecx
  805.                 imul ecx,[ebx+8] ;+8 = image height
  806.                 lea ecx,[ecx+ecx*2]
  807.                 mov [open_file_size],ecx
  808.                 stdcall mem.ReAlloc,[open_file_img],ecx
  809.                 mov [open_file_img],eax
  810.                 mov dword[buf_cop],eax
  811.                 mov dword[buf_cop.l],0 ;left = 0, top = 0
  812.                 m2m dword[buf_cop.h],dword[ebx+8]
  813.  
  814.                 ;¯à¥®¡à §ã¥¬ ¨§®¡à ¦¥­¨¥ ª ä®à¬ âã rgb
  815.                 stdcall [img_to_rgb2], ebx,[open_file_img]
  816.                 mov edi,buf_i0
  817.                 cmp buf2d_data,0
  818.                 jne .end3
  819.                         stdcall getNextPowerOfTwo,[ebx+8]
  820.                         mov buf2d_h,eax
  821.                         mov edx,eax
  822.                         stdcall getNextPowerOfTwo,[ebx+4]
  823.                         mov buf2d_w,eax
  824.                         cmp edx,[ebx+8]
  825.                         jne @f
  826.                         cmp eax,[ebx+4]
  827.                         jne @f
  828.                                 ;ᮧ¤ ­¨¥ ­®¢®£® ¨§®¡à ¦¥­¨ï ¯® ¨á室­ë¬ à §¬¥à ¬
  829.                                 stdcall [buf2d_create_f_img], edi,[open_file_img]
  830.                                 jmp .end_1
  831.                         @@:
  832.                                 ;ᮧ¤ ­¨¥ ­®¢®£® ¨§®¡à ¦¥­¨ï ¯® ¯à¥®¡à §®¢ ­­ë¬ à §¬¥à ¬
  833.                                 cmp eax,[ebx+4]
  834.                                 jge @f
  835.                                         mov eax,[ebx+4]
  836.                                         mov buf2d_w,eax
  837.                                 @@:
  838.                                 sub eax,[ebx+4]
  839.                                 shr eax,1
  840.                                 mov esi,eax
  841.                                 cmp edx,[ebx+8]
  842.                                 jge @f
  843.                                         mov edx,[ebx+8]
  844.                                         mov buf2d_h,edx
  845.                                 @@:
  846.                                 sub edx,[ebx+8]
  847.                                 shr edx,1
  848.                                 stdcall [buf2d_create], edi
  849.                                 mov [buf_cop.l],si
  850.                                 mov [buf_cop.t],dx
  851.                                 stdcall [buf2d_bit_blt], edi, esi,edx, buf_cop
  852.                                 jmp .end_1
  853.                 .end3:
  854.                         ;¯à¥®¡à §®¢ ­¨¥ ᮧ¤ ­­®£® ¨§®¡à ¦¥­¨ï
  855.                         stdcall getNextPowerOfTwo,[ebx+4]
  856.                         cmp eax,[ebx+4]
  857.                         jg @f
  858.                                 mov eax,[ebx+4]
  859.                         @@:
  860.                         mov ecx,eax ;à §¬¥à ¯® x
  861.                         stdcall getNextPowerOfTwo,[ebx+8]
  862.                         cmp eax,[ebx+8]
  863.                         jg @f
  864.                                 mov eax,[ebx+8]
  865.                         @@:
  866.                         mov edx,eax ;à §¬¥à ¯® y
  867.                         stdcall [buf2d_resize], edi, ecx,edx,1 ;¨§¬¥­ï¥¬ à §¬¥àë ¡ãä¥à 
  868.                         stdcall [buf2d_clear], edi, buf2d_color
  869.                         sub ecx,[ebx+4]
  870.                         shr ecx,1
  871.                         mov [buf_cop.l],cx
  872.                         sub edx,[ebx+8]
  873.                         shr edx,1
  874.                         mov [buf_cop.t],dx
  875.                         stdcall [buf2d_bit_blt], edi, ecx,edx, buf_cop
  876.                 .end_1:
  877.                
  878.                 ;ᮧ¤ ¥¬ ¡ãä¥à ¤«ï ¯à¥®¡à §®¢ ­­®£® ¨§®¡à ¦¥­¨ï
  879.                 mov edi,buf_ogl
  880.                 mov eax,[buf_i0.w]
  881.                 and eax, not 3
  882.                 mov buf2d_w,eax
  883.                 mov eax,[buf_i0.h]
  884.                 and eax, not 3
  885.                 mov buf2d_h,eax
  886.                 cmp buf2d_data,0
  887.                 jne @f
  888.                         stdcall [kosglMakeCurrent], 0,35,buf2d_w,buf2d_h,ctx1
  889.                         stdcall [glEnable], GL_DEPTH_TEST
  890.                         stdcall [glEnable], GL_NORMALIZE ;¤¥« ¬ ­®à¬ «¨ ®¤¨­ ª®¢®© ¢¥«¨ç¨­ë ¢® ¨§¡¥¦ ­¨¥  àâ¥ä ªâ®¢
  891.                         stdcall [glShadeModel], GL_SMOOTH
  892.                         stdcall [glScalef], 2.0, -2.0, 1.0
  893.                         stdcall [glTranslatef], -0.5, -0.5, 0.0
  894.                         jmp .end_2
  895.                 @@:
  896.                         stdcall reshape, buf2d_w,buf2d_h ;¨§¬¥­ï¥¬ à §¬¥àë ¡ãä¥à  buf_ogl
  897.                 .end_2:
  898.                 mov eax,dword[ctx1] ;eax -> TinyGLContext.GLContext
  899.                 mov eax,[eax] ;eax -> ZBuffer
  900.                 mov eax,[eax+offs_zbuf_pbuf] ;eax -> ZBuffer.pbuf
  901.                 mov buf2d_data,eax
  902.  
  903.                 stdcall [buf2d_bit_blt], edi, 0,0, buf_i0 ;ª®¯¨à㥬 ¨§®¡à ¦¥­¨¥ ¤«ï ¢®áâ ­®¢«¥­¨ï
  904.  
  905.                 ;* Setup texturing *
  906.                 stdcall [glTexEnvi], GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_DECAL
  907.  
  908.                 ;* generate texture object IDs *
  909.                 stdcall [glGenTextures], 1, TexObj
  910.                 stdcall [glBindTexture], GL_TEXTURE_2D, [TexObj]
  911.                 stdcall [glTexImage2D], GL_TEXTURE_2D, 0, 3, [buf_i0.w], [buf_i0.h],\
  912.                         0, GL_RGB, GL_UNSIGNED_BYTE, [buf_i0] ;¤¥« ¥¬ ⥪áâãàã ­  ®á­®¢¥ ¡ãä¥à , á ¬® ¨§®¡à ¦¥­¨¥ ¢ ¡ãä¥à¥ ¬®¦¥â ¨á¯®àâ¨âáï ¯à¨ ¯®¤£®­ª¥ à §¬¥à®¢ ⥪áâãàë
  913.  
  914.                 stdcall [glTexParameteri], GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST
  915.                 stdcall [glTexParameteri], GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST
  916.                 stdcall [glTexParameteri], GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT
  917.                 stdcall [glTexParameteri], GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT
  918.                 stdcall [glBindTexture], GL_TEXTURE_2D, [TexObj]
  919.                 stdcall [glEnable], GL_TEXTURE_2D
  920.  
  921.                 stdcall [buf2d_bit_blt], buf_i0, 0,0, edi ;¢®áâ ­ ¢«¨¢ ¥¬ ¨§®¡à ¦¥­¨¥ ¨á¯®à祭®¥ ¯à¨ ãáâ ­®¢ª¥ ⥪áâãàë
  922.  
  923.                 ;㤠«ï¥¬ ¢à¥¬¥­­ë© ¡ãä¥à ¢ ebx
  924.                 stdcall [img_destroy], ebx
  925.                
  926.                 movzx eax,word[buf_cop.l]
  927.                 movzx ebx,word[buf_cop.t]
  928.                 stdcall points_init_2,eax,ebx
  929.  
  930.                 call calc_nav_params
  931.                 stdcall nav_to_point, dword[sel_pt+point2d.x],dword[sel_pt+point2d.y]
  932.                 mov byte[view_b],0
  933.                 mov dword[sel_act],-1 ;á­¨¬ ¥¬ ¢ë¤¥«¥­¨¥ á â®ç¥ª
  934.                 mov byte[calc],1
  935.         .end_0:
  936.  
  937.         .end_open_file:
  938.         popad
  939.         ret
  940. endp
  941.  
  942. align 4
  943. proc nav_to_point, coord_x:dword, coord_y:dword
  944.         ;coord x
  945.         mov eax,[nav_x_max]
  946.         cmp eax,0
  947.         jle @f
  948.                 ;¥á«¨ ¬ «¥­ìª®¥ ¨§®¡à ¦¥­¨¥ â® áâ ¢¨¬ ¯® 業âàã
  949.                 shr eax,1
  950.                 jmp .end0
  951.         @@:
  952.         mov eax,[buf_0.w]
  953.         shr eax,1
  954.         sub eax,[coord_x]
  955.         call nav_x_corect
  956.         .end0:
  957.         mov [nav_x],eax
  958.         ;coord y
  959.         mov eax,[nav_y_max]
  960.         cmp eax,0
  961.         jle @f
  962.                 ;¥á«¨ ¬ «¥­ìª®¥ ¨§®¡à ¦¥­¨¥ â® áâ ¢¨¬ ¯® 業âàã
  963.                 shr eax,1
  964.                 jmp .end1
  965.         @@:
  966.         mov eax,[buf_0.h]
  967.         shr eax,1
  968.         sub eax,[coord_y]
  969.         call nav_y_corect
  970.         .end1:
  971.         mov [nav_y],eax
  972.         ret
  973. endp
  974.  
  975. ;input:
  976. ; eax - navigation coord x
  977. ;output:
  978. ; eax - valid coord x
  979. align 4
  980. nav_x_corect:
  981.         cmp eax,[nav_x_min]
  982.         jge @f
  983.                 mov eax,[nav_x_min]
  984.         @@:
  985.         cmp eax,[nav_x_max]
  986.         jle @f
  987.                 mov eax,[nav_x_max]
  988.         @@:
  989.         ret
  990.  
  991. ;input:
  992. ; eax - navigation coord y
  993. ;output:
  994. ; eax - valid coord y
  995. align 4
  996. nav_y_corect:
  997.         cmp eax,[nav_y_min]
  998.         jge @f
  999.                 mov eax,[nav_y_min]
  1000.         @@:
  1001.         cmp eax,[nav_y_max]
  1002.         jle @f
  1003.                 mov eax,[nav_y_max]
  1004.         @@:
  1005.         ret
  1006.  
  1007. align 4
  1008. proc getNextPowerOfTwo uses ebx, n:dword
  1009.         mov ebx,[n]
  1010.         mov eax,8 ;min size
  1011.         cmp ebx,eax
  1012.         jle .set
  1013.         @@:
  1014.                 shl eax,1
  1015.                 cmp ebx,eax
  1016.                 jg @b
  1017.         cmp eax,4096 ;max size
  1018.         jle .set
  1019.                 mov eax,4096
  1020.         .set:
  1021.         ret
  1022. endp
  1023.  
  1024. ; new window size or exposure
  1025. align 4
  1026. proc reshape uses ebx ecx, width:dword, height:dword
  1027.         stdcall [glViewport], 0, 0, [width], [height]
  1028.         stdcall [glMatrixMode], GL_MODELVIEW
  1029.         stdcall [glLoadIdentity]
  1030.         stdcall [glScalef], 2.0, -2.0, 1.0
  1031.         stdcall [glTranslatef], -0.5, -0.5, 0.0
  1032.         ret
  1033. endp
  1034.  
  1035. align 4
  1036. proc but_save_file
  1037. locals
  1038.         png_data dd 0
  1039.         png_size dd 0
  1040. endl
  1041.         pushad
  1042.         copy_path open_dialog_name,communication_area_default_path,file_name,0
  1043.         mov [OpenDialog_data.type],1
  1044.         stdcall [OpenDialog_Set_file_ext],OpenDialog_data,Filter.1 ;.png
  1045.         stdcall [OpenDialog_Start],OpenDialog_data
  1046.         cmp [OpenDialog_data.status],1
  1047.         jne .end_save_file
  1048.                 ;ª®¤ ¯à¨ 㤠筮¬ ®âªàë⨨ ¤¨ «®£ 
  1049.                 mov dword[png_data],0
  1050.  
  1051.                 ;create image struct
  1052.                 stdcall [img_create], [buf_ogl.w], [buf_ogl.h], Image.bpp24
  1053.                 mov ebx,eax
  1054.                 test eax,eax
  1055.                 jz @f
  1056.                         ;copy foto to image buffer
  1057.                         mov edi,[eax+Image.Data]
  1058.                         mov esi,[buf_ogl]
  1059.                         mov ecx,[buf_ogl.w]
  1060.                         mov edx,[buf_ogl.h]
  1061.                         imul ecx,edx
  1062.                         imul ecx,3
  1063.                         shr ecx,2 ;OpenGL buffer align to 4
  1064.                         rep movsd
  1065.  
  1066.                         ;encode image
  1067.                         stdcall [img_encode], eax, LIBIMG_FORMAT_PNG, 0
  1068.                         test eax,eax
  1069.                         jz @f
  1070.                                 mov [png_data],eax
  1071.                                 mov [png_size],ecx
  1072.                 @@:
  1073.                 stdcall [img_destroy],ebx
  1074.  
  1075.         ; § ¯®«­ï¥¬ áâàãªâãàã ¤«ï á®åà ­¥­¨ï ä ©« 
  1076.         mov ebx,run_file_70
  1077.         mov dword[ebx],SSF_CREATE_FILE
  1078.         mov eax,[png_size]
  1079.         mov [ebx+12],eax ;file size
  1080.         mov eax,[png_data]
  1081.         mov [ebx+16],eax
  1082.         mov dword[ebx+FileInfoBlock.FileName], openfile_path
  1083.  
  1084.         mcall SF_FILE,run_file_70
  1085.         test eax,eax
  1086.         jnz .save_error
  1087.                         ;notify_window_run openfile_path
  1088.                         jmp @f
  1089.                 .save_error:
  1090.                         ;á®®¡é¥­¨¥ ® ­¥ã¤ ç­®¬ á®åà ­¥­¨¨
  1091.                         notify_window_run txt_err_save_img_file
  1092.                 @@:
  1093.                 mcall SF_SYS_MISC, SSF_MEM_FREE, [png_data]
  1094.         .end_save_file:
  1095.         popad
  1096.         ret
  1097. endp
  1098.  
  1099. align 4
  1100. but_2:
  1101.         xor byte[view_b],1
  1102.         mov byte[calc],1
  1103.         ret
  1104.  
  1105. align 4
  1106. but_3:
  1107.         xor byte[trans_a],1
  1108.         call points_update_prop
  1109.         mov byte[calc],1
  1110.         ret
  1111.  
  1112. align 4
  1113. but_about:
  1114.         notify_window_run txt_about
  1115.         ret
  1116.  
  1117. align 4
  1118. calc db 0
  1119. view_b db 0 ;0 - ¨á室­ë© ¡ãä¥à, 1 - ¯à®á¬®âà १ã«ìâ â 
  1120. trans_a db 0 ;0 - ¯à¥®¡à §®¢ âì ¯® § ¤ ­­®¬ã à §¬¥àã, 1 - ¯à¥®¡à §®¢ âì ­  ¢¥áì ¡ãä¥à
  1121.  
  1122. align 4
  1123. proc but_img_move_up uses eax
  1124.         cmp dword[sel_act],-1
  1125.         je .end0
  1126.                 mov eax,[sel_act]
  1127.                 imul eax,sizeof.point2d
  1128.                 add eax,sel_pt
  1129.                 cmp dword[eax+point2d.y],0
  1130.                 je .end2
  1131.                 dec dword[eax+point2d.y]
  1132.                 call points_update_prop
  1133.                 jmp .end1
  1134.         .end0:
  1135.         mov eax,[nav_y]
  1136.         sub eax,[nav_sy]
  1137.         cmp eax,[nav_y_min]
  1138.         jge @f
  1139.                 mov eax,[nav_y_min]
  1140.         @@:
  1141.         mov [nav_y],eax
  1142.         .end1:
  1143.         mov byte[calc],1
  1144.         .end2:
  1145.         ret
  1146. endp
  1147.  
  1148. align 4
  1149. proc but_img_move_down uses eax edi
  1150.         cmp dword[sel_act],-1
  1151.         je .end0
  1152.                 mov eax,[sel_act]
  1153.                 imul eax,sizeof.point2d
  1154.                 add eax,sel_pt
  1155.                 mov edi,buf_ogl
  1156.                 mov edi,buf2d_h
  1157.                 cmp dword[eax+point2d.y],edi
  1158.                 jge .end2
  1159.                 inc dword[eax+point2d.y]
  1160.                 call points_update_prop
  1161.                 jmp .end1
  1162.         .end0:
  1163.         mov eax,[nav_y]
  1164.         add eax,[nav_sy]
  1165.         cmp eax,[nav_y_max]
  1166.         jle @f
  1167.                 mov eax,[nav_y_max]
  1168.         @@:
  1169.         mov [nav_y],eax
  1170.         .end1:
  1171.         mov byte[calc],1
  1172.         .end2:
  1173.         ret
  1174. endp
  1175.  
  1176. align 4
  1177. proc but_img_move_left uses eax
  1178.         cmp dword[sel_act],-1
  1179.         je .end0
  1180.                 mov eax,[sel_act]
  1181.                 imul eax,sizeof.point2d
  1182.                 add eax,sel_pt
  1183.                 cmp dword[eax+point2d.x],0
  1184.                 je .end2
  1185.                 dec dword[eax+point2d.x]
  1186.                 call points_update_prop
  1187.                 jmp .end1
  1188.         .end0:
  1189.         mov eax,[nav_x]
  1190.         sub eax,[nav_sx]
  1191.         cmp eax,[nav_x_min]
  1192.         jge @f
  1193.                 mov eax,[nav_x_min]
  1194.         @@:
  1195.         mov [nav_x],eax
  1196.         .end1:
  1197.         mov byte[calc],1
  1198.         .end2:
  1199.         ret
  1200. endp
  1201.  
  1202. align 4
  1203. proc but_img_move_right uses eax edi
  1204.         cmp dword[sel_act],-1
  1205.         je .end0
  1206.                 mov eax,[sel_act]
  1207.                 imul eax,sizeof.point2d
  1208.                 add eax,sel_pt
  1209.                 mov edi,buf_ogl
  1210.                 mov edi,buf2d_w
  1211.                 cmp dword[eax+point2d.x],edi
  1212.                 jge .end2
  1213.                 inc dword[eax+point2d.x]
  1214.                 call points_update_prop
  1215.                 jmp .end1
  1216.         .end0:
  1217.         mov eax,[nav_x]
  1218.         add eax,[nav_sx]
  1219.         cmp eax,[nav_x_max]
  1220.         jle @f
  1221.                 mov eax,[nav_x_max]
  1222.         @@:
  1223.         mov [nav_x],eax
  1224.         .end1:
  1225.         mov byte[calc],1
  1226.         .end2:
  1227.         ret
  1228. endp
  1229.  
  1230. ;input:
  1231. ; eax - ç¨á«®
  1232. ; edi - ¡ãä¥à ¤«ï áâப¨
  1233. ; len - ¤«¨­­  ¡ãä¥à 
  1234. ;output:
  1235. align 4
  1236. proc convert_int_to_str, len:dword
  1237. pushad
  1238.         mov esi,[len]
  1239.         add esi,edi
  1240.         dec esi
  1241.         bt eax,31
  1242.         jae @f
  1243.                 ;¥á«¨ ç¨á«® ®âà¨æ â¥«ì­®¥
  1244.                 neg eax
  1245.                 mov byte[edi],'-'
  1246.                 inc edi
  1247.         @@:
  1248.         call .str
  1249. popad
  1250.         ret
  1251. endp
  1252.  
  1253. align 4
  1254. .str:
  1255.         mov ecx,10
  1256.         cmp eax,ecx
  1257.         jb @f
  1258.                 xor edx,edx
  1259.                 div ecx
  1260.                 push edx
  1261.                 ;dec edi  ;ᬥ饭¨¥ ­¥®¡å®¤¨¬®¥ ¤«ï § ¯¨á¨ á ª®­æ  áâப¨
  1262.                 call .str
  1263.                 pop eax
  1264.         @@:
  1265.         cmp edi,esi
  1266.         jge @f
  1267.                 or al,0x30
  1268.                 stosb
  1269.                 mov byte[edi],0 ;¢ ª®­¥æ áâப¨ áâ ¢¨¬ 0, çâ®-¡ë ­¥ ¢ë« §¨« ¬ãá®à
  1270.         @@:
  1271.         ret
  1272.  
  1273. ;¤ ­­ë¥ ¤«ï ¤¨ «®£  ®âªàëâ¨ï ä ©«®¢
  1274. align 4
  1275. OpenDialog_data:
  1276. .type                   dd 0 ;0 - ®âªàëâì, 1 - á®åà ­¨âì, 2 - ¢ë¡à âì ¤â४â®à¨î
  1277. .procinfo               dd procinfo     ;+4
  1278. .com_area_name          dd communication_area_name      ;+8
  1279. .com_area               dd 0    ;+12
  1280. .opendir_path           dd plugin_path  ;+16
  1281. .dir_default_path       dd default_dir ;+20
  1282. .start_path             dd file_name ;+24 ¯ãâì ª ¤¨ «®£ã ®âªàëâ¨ï ä ©«®¢
  1283. .draw_window            dd draw_window  ;+28
  1284. .status                 dd 0    ;+32
  1285. .openfile_path          dd openfile_path        ;+36 ¯ãâì ª ®âªà뢠¥¬®¬ã ä ©«ã
  1286. .filename_area          dd filename_area        ;+40
  1287. .filter_area            dd Filter
  1288. .x:
  1289. .x_size                 dw 420 ;+48 ; Window X size
  1290. .x_start                dw 10 ;+50 ; Window X position
  1291. .y:
  1292. .y_size                 dw 320 ;+52 ; Window y size
  1293. .y_start                dw 10 ;+54 ; Window Y position
  1294.  
  1295. default_dir db '/rd/1',0
  1296.  
  1297. communication_area_name:
  1298.         db 'FFFFFFFF_open_dialog',0
  1299. open_dialog_name:
  1300.         db 'opendial',0
  1301. communication_area_default_path:
  1302.         db '/rd/1/File managers/',0
  1303.  
  1304. Filter:
  1305. dd Filter.end - Filter ;.1
  1306. .1:
  1307. db 'PNG',0
  1308. db 'JPG',0
  1309. db 'JPEG',0
  1310. db 'BMP',0
  1311. db 'GIF',0
  1312. .end:
  1313. db 0
  1314.  
  1315. txt_space db ' ',0
  1316.  
  1317. if lang eq ru
  1318.         txt_err_save_img_file db '¥ ¬®£ã á®åà ­¨âì *.png ä ©«.',0
  1319.         txt_about db '"Ž ¯à®£à ¬¬¥',13,10,\
  1320.         '„ ­­ ï ¯à®£à ¬¬  ᤥ« ­  ¤«ï ¯à¥®¡à §®¢ ­¨ï ¨§®¡à ¦¥­¨©.',13,10,\
  1321.         '®á«¥ ®âªàëâ¨ï ä ©«  ¨§®¡à ¦¥­¨ï ­ã¦­® 㪠§ âì 4 â®çª¨,',13,10,\
  1322.         'ª®â®àë¥ áâ ­ãâ 㣫 ¬¨ ¯à¥®¡à §®¢ ­®£® ¨§®¡à ¦¥­¨ï." -tI',0
  1323.         txt_pref db ' ¡ ',0,' Š¡',0,' Œ¡',0,' ƒ¡',0 ;¯à¨áâ ¢ª¨: ª¨«®, ¬¥£ , £¨£ 
  1324.         txt_f_size db ' §¬¥à: '
  1325. .size: rb 16
  1326.         txt_img_w db '˜¨à¨­ : '
  1327. .size: rb 16
  1328.         txt_img_h db '‚ëá®â : '
  1329. else
  1330.         txt_err_save_img_file db 'Can',39,'t save *.png file.',0
  1331.         txt_about db '"About',13,10,\
  1332.         'This program is designed to convert images.',13,10,\
  1333.         'After opening the image file, you need to specify 4 points',13,10,\
  1334.         'that will become the corners of the converted image." -tI',0
  1335.         txt_pref db ' b ',0,' Kb',0,' Mb',0,' Gb',0 ;¯à¨áâ ¢ª¨: ª¨«®, ¬¥£ , £¨£ 
  1336.         txt_f_size db 'Size: '
  1337. .size: rb 16
  1338.         txt_img_w db 'Width: '
  1339. .size: rb 16
  1340.         txt_img_h db 'Height: '
  1341. end if
  1342. .size: rb 16
  1343.  
  1344.  
  1345. system_dir_0 db '/sys/lib/'
  1346. lib_name_0 db 'proc_lib.obj',0
  1347. system_dir_1 db '/sys/lib/'
  1348. lib_name_1 db 'libimg.obj',0
  1349. system_dir_2 db '/sys/lib/'
  1350. lib_name_2 db 'buf2d.obj',0
  1351. system_dir_3 db '/sys/lib/'
  1352. lib_name_3 db 'tinygl.obj',0
  1353.  
  1354. align 4
  1355. head_f_i:
  1356. if lang eq ru
  1357. head_f_l db '"‘¨á⥬­ ï ®è¨¡ª ',0
  1358. err_message_found_lib_0 db '¥ ­ ©¤¥­  ¡¨¡«¨®â¥ª  ',39,'proc_lib.obj',39,'" -tE',0
  1359. err_message_import_0 db 'Žè¨¡ª  ¯à¨ ¨¬¯®à⥠¡¨¡«¨®â¥ª¨ ',39,'proc_lib.obj',39,'" -tE',0
  1360. err_message_found_lib_1 db '¥ ­ ©¤¥­  ¡¨¡«¨®â¥ª  ',39,'libimg.obj',39,'" -tE',0
  1361. err_message_import_1 db 'Žè¨¡ª  ¯à¨ ¨¬¯®à⥠¡¨¡«¨®â¥ª¨ ',39,'libimg.obj',39,'" -tE',0
  1362. err_msg_found_lib_2 db '¥ ­ ©¤¥­  ¡¨¡«¨®â¥ª  ',39,'buf2d.obj',39,'" -tE',0
  1363. err_msg_import_2 db 'Žè¨¡ª  ¯à¨ ¨¬¯®à⥠¡¨¡«¨®â¥ª¨ ',39,'buf2d',39,'" -tE',0
  1364. err_msg_found_lib_3 db '¥ ­ ©¤¥­  ¡¨¡«¨®â¥ª  ',39,'tinygl.obj',39,'" -tE',0
  1365. err_msg_import_3 db 'Žè¨¡ª  ¯à¨ ¨¬¯®à⥠¡¨¡«¨®â¥ª¨ ',39,'tinygl',39,'" -tE',0
  1366. else
  1367. head_f_l db '"System error',0
  1368. err_message_found_lib_0 db 'Sorry I cannot found library ',39,'proc_lib.obj',39,'" -tE',0
  1369. err_message_import_0 db 'Error on load import library ',39,'proc_lib.obj',39,'" -tE',0
  1370. err_message_found_lib_1 db 'Sorry I cannot found library ',39,'libimg.obj',39,'" -tE',0
  1371. err_message_import_1 db 'Error on load import library ',39,'libimg.obj',39,'" -tE',0
  1372. err_msg_found_lib_2 db 'Sorry I cannot found library ',39,'buf2d.obj',39,'" -tE',0
  1373. err_msg_import_2 db 'Error on load import library ',39,'buf2d',39,'" -tE',0
  1374. err_msg_found_lib_3 db 'Sorry I cannot found library ',39,'tinygl.obj',39,'" -tE',0
  1375. err_msg_import_3 db 'Error on load import library ',39,'tinygl',39,'" -tE',0
  1376. end if
  1377.  
  1378. align 4
  1379. l_libs_start:
  1380.         lib_0 l_libs lib_name_0, sys_path, file_name, system_dir_0,\
  1381.                 err_message_found_lib_0, head_f_l, proclib_import,err_message_import_0, head_f_i
  1382.         lib_1 l_libs lib_name_1, sys_path, file_name, system_dir_1,\
  1383.                 err_message_found_lib_1, head_f_l, import_libimg, err_message_import_1, head_f_i
  1384.         lib_2 l_libs lib_name_2, sys_path, library_path, system_dir_2,\
  1385.                 err_msg_found_lib_2,head_f_l,import_buf2d,err_msg_import_2,head_f_i
  1386.         lib_3 l_libs lib_name_3, sys_path, library_path, system_dir_3,\
  1387.                 err_msg_found_lib_3,head_f_l,import_lib_tinygl,err_msg_import_3,head_f_i
  1388. l_libs_end:
  1389.  
  1390. align 4
  1391. import_libimg:
  1392.         dd alib_init1
  1393.         img_is_img  dd aimg_is_img
  1394.         img_info    dd aimg_info
  1395.         img_from_file dd aimg_from_file
  1396.         img_to_file dd aimg_to_file
  1397.         img_from_rgb dd aimg_from_rgb
  1398.         img_to_rgb  dd aimg_to_rgb
  1399.         img_to_rgb2 dd aimg_to_rgb2
  1400.         img_decode  dd aimg_decode
  1401.         img_encode  dd aimg_encode
  1402.         img_create  dd aimg_create
  1403.         img_destroy dd aimg_destroy
  1404.         img_destroy_layer dd aimg_destroy_layer
  1405.         img_count   dd aimg_count
  1406.         img_lock_bits dd aimg_lock_bits
  1407.         img_unlock_bits dd aimg_unlock_bits
  1408.         img_flip    dd aimg_flip
  1409.         img_flip_layer dd aimg_flip_layer
  1410.         img_rotate  dd aimg_rotate
  1411.         img_rotate_layer dd aimg_rotate_layer
  1412.         img_draw    dd aimg_draw
  1413.  
  1414.         dd 0,0
  1415.         alib_init1   db 'lib_init',0
  1416.         aimg_is_img  db 'img_is_img',0 ;®¯à¥¤¥«ï¥â ¯® ¤ ­­ë¬, ¬®¦¥â «¨ ¡¨¡«¨®â¥ª  ᤥ« âì ¨§ ­¨å ¨§®¡à ¦¥­¨¥
  1417.         aimg_info    db 'img_info',0
  1418.         aimg_from_file db 'img_from_file',0
  1419.         aimg_to_file db 'img_to_file',0
  1420.         aimg_from_rgb db 'img_from_rgb',0
  1421.         aimg_to_rgb  db 'img_to_rgb',0 ;¯à¥®¡à §®¢ ­¨¥ ¨§®¡à ¦¥­¨ï ¢ ¤ ­­ë¥ RGB
  1422.         aimg_to_rgb2 db 'img_to_rgb2',0
  1423.         aimg_decode  db 'img_decode',0 ; ¢â®¬ â¨ç¥áª¨ ®¯à¥¤¥«ï¥â ä®à¬ â £à ä¨ç¥áª¨å ¤ ­­ëå
  1424.         aimg_encode  db 'img_encode',0
  1425.         aimg_create  db 'img_create',0
  1426.         aimg_destroy db 'img_destroy',0
  1427.         aimg_destroy_layer db 'img_destroy_layer',0
  1428.         aimg_count   db 'img_count',0
  1429.         aimg_lock_bits db 'img_lock_bits',0
  1430.         aimg_unlock_bits db 'img_unlock_bits',0
  1431.         aimg_flip    db 'img_flip',0
  1432.         aimg_flip_layer db 'img_flip_layer',0
  1433.         aimg_rotate  db 'img_rotate',0
  1434.         aimg_rotate_layer db 'img_rotate_layer',0
  1435.         aimg_draw    db 'img_draw',0
  1436.  
  1437. align 4
  1438. proclib_import: ;®¯¨á ­¨¥ íªá¯®àâ¨à㥬ëå ä㭪権
  1439.         OpenDialog_Init dd aOpenDialog_Init
  1440.         OpenDialog_Start dd aOpenDialog_Start
  1441.         OpenDialog_Set_file_name dd aOpenDialog_Set_file_name
  1442.         OpenDialog_Set_file_ext dd aOpenDialog_Set_file_ext
  1443. dd 0,0
  1444.         aOpenDialog_Init db 'OpenDialog_init',0
  1445.         aOpenDialog_Start db 'OpenDialog_start',0
  1446.         aOpenDialog_Set_file_name db 'OpenDialog_set_file_name',0
  1447.         aOpenDialog_Set_file_ext db 'OpenDialog_set_file_ext',0
  1448.  
  1449. align 4
  1450. import_buf2d:
  1451.         init dd sz_init
  1452.         buf2d_create dd sz_buf2d_create
  1453.         buf2d_create_f_img dd sz_buf2d_create_f_img
  1454.         buf2d_clear dd sz_buf2d_clear
  1455.         buf2d_draw dd sz_buf2d_draw
  1456.         buf2d_delete dd sz_buf2d_delete
  1457.         buf2d_resize dd sz_buf2d_resize
  1458.         buf2d_line dd sz_buf2d_line
  1459.         buf2d_rect_by_size dd sz_buf2d_rect_by_size
  1460.         buf2d_filled_rect_by_size dd sz_buf2d_filled_rect_by_size
  1461.         buf2d_circle dd sz_buf2d_circle
  1462.         buf2d_img_hdiv2 dd sz_buf2d_img_hdiv2
  1463.         buf2d_img_wdiv2 dd sz_buf2d_img_wdiv2
  1464.         buf2d_conv_24_to_8 dd sz_buf2d_conv_24_to_8
  1465.         buf2d_conv_24_to_32 dd sz_buf2d_conv_24_to_32
  1466.         buf2d_bit_blt dd sz_buf2d_bit_blt
  1467.         buf2d_bit_blt_transp dd sz_buf2d_bit_blt_transp
  1468.         buf2d_bit_blt_alpha dd sz_buf2d_bit_blt_alpha
  1469.         buf2d_curve_bezier dd sz_buf2d_curve_bezier
  1470.         buf2d_convert_text_matrix dd sz_buf2d_convert_text_matrix
  1471.         buf2d_draw_text dd sz_buf2d_draw_text
  1472.         buf2d_crop_color dd sz_buf2d_crop_color
  1473.         buf2d_offset_h dd sz_buf2d_offset_h
  1474.         buf2d_flood_fill dd sz_buf2d_flood_fill
  1475.         buf2d_set_pixel dd sz_buf2d_set_pixel
  1476.         buf2d_get_pixel dd sz_buf2d_get_pixel
  1477.         dd 0,0
  1478.         sz_init db 'lib_init',0
  1479.         sz_buf2d_create db 'buf2d_create',0
  1480.         sz_buf2d_create_f_img db 'buf2d_create_f_img',0
  1481.         sz_buf2d_clear db 'buf2d_clear',0
  1482.         sz_buf2d_draw db 'buf2d_draw',0
  1483.         sz_buf2d_delete db 'buf2d_delete',0
  1484.         sz_buf2d_resize db 'buf2d_resize',0
  1485.         sz_buf2d_line db 'buf2d_line',0
  1486.         sz_buf2d_rect_by_size db 'buf2d_rect_by_size',0
  1487.         sz_buf2d_filled_rect_by_size db 'buf2d_filled_rect_by_size',0
  1488.         sz_buf2d_circle db 'buf2d_circle',0
  1489.         sz_buf2d_img_hdiv2 db 'buf2d_img_hdiv2',0
  1490.         sz_buf2d_img_wdiv2 db 'buf2d_img_wdiv2',0
  1491.         sz_buf2d_conv_24_to_8 db 'buf2d_conv_24_to_8',0
  1492.         sz_buf2d_conv_24_to_32 db 'buf2d_conv_24_to_32',0
  1493.         sz_buf2d_bit_blt db 'buf2d_bit_blt',0
  1494.         sz_buf2d_bit_blt_transp db 'buf2d_bit_blt_transp',0
  1495.         sz_buf2d_bit_blt_alpha db 'buf2d_bit_blt_alpha',0
  1496.         sz_buf2d_curve_bezier db 'buf2d_curve_bezier',0
  1497.         sz_buf2d_convert_text_matrix db 'buf2d_convert_text_matrix',0
  1498.         sz_buf2d_draw_text db 'buf2d_draw_text',0
  1499.         sz_buf2d_crop_color db 'buf2d_crop_color',0
  1500.         sz_buf2d_offset_h db 'buf2d_offset_h',0
  1501.         sz_buf2d_flood_fill db 'buf2d_flood_fill',0
  1502.         sz_buf2d_set_pixel db 'buf2d_set_pixel',0
  1503.         sz_buf2d_get_pixel db 'buf2d_get_pixel',0
  1504.  
  1505. align 4
  1506. import_lib_tinygl:
  1507.  
  1508. macro E_LIB n
  1509. {
  1510.         n dd sz_#n
  1511. }
  1512. include '../../../programs/develop/libraries/TinyGL/asm_fork/export.inc'
  1513.         dd 0,0
  1514. macro E_LIB n
  1515. {
  1516.         sz_#n db `n,0
  1517. }
  1518. include '../../../programs/develop/libraries/TinyGL/asm_fork/export.inc'
  1519.  
  1520. align 4
  1521. buf_0: dd 0
  1522. .l: dw 5 ;+4 left
  1523. .t: dw 35 ;+6 top
  1524. .w: dd 6*64 ;+8 w
  1525. .h: dd 7*64 ;+12 h
  1526. .color: dd 0x808080 ;+16 color
  1527.         db 24 ;+20 bit in pixel
  1528.  
  1529. align 4
  1530. buf_font:
  1531.         dd 0 ;㪠§ â¥«ì ­  ¡ãä¥à ¨§®¡à ¦¥­¨ï
  1532.         dd 0 ;+4 left,top
  1533. .w: dd 0
  1534. .h: dd 0,0,24
  1535.  
  1536. align 4
  1537. buf_cop: ;¡ãä¥à ¤«ï ª®¯¨à®¢ ­¨ï ⥪áâãàë
  1538.         dd 0
  1539. .l: dw 0 ;+4 left
  1540. .t: dw 0 ;+6 top
  1541. .w: dd 0
  1542. .h: dd 0,0,24
  1543.  
  1544. ;¨á室­®¥ ¨§®¡à ¦¥­¨¥
  1545. align 4
  1546. buf_i0: dd 0,0
  1547. .w: dd 0
  1548. .h: dd 0
  1549. .color: dd 0,24
  1550.  
  1551. ;¯à¥®¡à §®¢ ­®¥ ¨§®¡à ¦¥­¨¥
  1552. align 4
  1553. buf_ogl: dd 0,0
  1554. .w: dd 0
  1555. .h: dd 0
  1556. .color: dd 0,24
  1557.  
  1558. align 16
  1559. i_end:
  1560. ctx1 db 28 dup (0) ;TinyGLContext or KOSGLContext
  1561. ;sizeof.TinyGLContext = 28
  1562. TexObj dd 0 ;¬ áᨢ 㪠§ â¥«¥© ­  ⥪áâãàë (¢ ¤ ­­®¬ á«ãç ¥ 1 èâ.)
  1563. nav_x_min dd 0 ;¬¨­. ª®®à¤. x ¤«ï ­ ¢¨£ æ¨¨
  1564. nav_y_min dd 0 ;¬¨­. ª®®à¤. y ¤«ï ­ ¢¨£ æ¨¨
  1565. nav_x_max dd 0 ;¬ ªá. ª®®à¤. x
  1566. nav_y_max dd 0 ;¬ ªá. ª®®à¤. y
  1567. nav_x dd 0 ;⥪ãé. ª®®à¤. x ¤«ï ­ ¢¨£ æ¨¨
  1568. nav_y dd 0 ;⥪ãé. ª®®à¤. y ¤«ï ­ ¢¨£ æ¨¨
  1569. nav_sx dd 0 ;áªà®« ¯® x
  1570. nav_sy dd 0 ;áªà®« ¯® y
  1571. nav_wnd_w dd 0 ;è¨à¨­  ®ª­  ­ ¢¨£ æ¨¨
  1572. nav_wnd_h dd 0 ;¢ëá® â  ®ª­  ­ ¢¨£ æ¨¨
  1573. nav_wnd_zoom dd 0
  1574. mouse_down_x dd ?
  1575. mouse_down_y dd ?
  1576. sel_act dd ? ;â®çª  ¢ë¡à ­­ ï ¤«ï । ªâ¨à®¢ ­¨ï á ª« ¢¨ âãàë
  1577. sel_pt rb 8*sizeof.point2d ;â®çª¨ ¤«ï ¢ë¡®à  4-å 㣫®¢
  1578. last_time dd 0
  1579. txt_buf rb 8
  1580. procinfo process_information
  1581. sc system_colors
  1582. run_file_70 FileInfoBlock
  1583.                 rb 4096
  1584. align 16
  1585. stacktop:
  1586.         sys_path rb 1024
  1587.         file_name:
  1588.                 rb 1024 ;4096
  1589.         library_path rb 1024
  1590.         plugin_path rb 4096
  1591.         openfile_path rb 4096
  1592.         filename_area rb 256
  1593. mem:
  1594.