Subversion Repositories Kolibri OS

Rev

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

  1. format binary as ""
  2.  
  3. use32
  4. org 0x0
  5.  
  6. db 'MENUET01'
  7. dd 0x01, START, I_END, F_END, stacktop, @PARAMS, sys_path
  8.  
  9. ;-----------------------------------------------------------------------------
  10.  
  11. include '../../../config.inc'
  12. include '../../../proc32.inc'
  13. include '../../../macros.inc'
  14. include '../../../dll.inc'
  15. include '../../../KOSfuncs.inc'
  16. ;include '../../../debug.inc'
  17.  
  18. include '../../../develop/libraries/libs-dev/libio/libio.inc'
  19. include '../../../develop/libraries/libs-dev/libimg/libimg.inc'
  20.  
  21. ;include '../../../develop/libraries/box_lib/asm/trunk/opendial.mac'
  22. ;use_OpenDialog
  23. ;-----------------------------------------------------------------------------
  24.  
  25. START:
  26.     mcall   SF_SYS_MISC, SSF_HEAP_INIT
  27.  
  28.     stdcall dll.Load, @IMPORT
  29.     or  eax, eax
  30.     jnz exit
  31.  
  32.     invoke  sort.START, 1
  33.  
  34.     mov ecx, 1  ; for 15.4: 1 = tile
  35.     cmp word [@PARAMS], '\T'
  36.     jz  set_bgr
  37.     inc ecx ; for 15.4: 2 = stretch
  38.     cmp word [@PARAMS], '\S'
  39.     jz  set_bgr
  40.  
  41.     cmp byte [@PARAMS], 0
  42.     jz @f
  43.     mov esi, @PARAMS
  44.     mov edi, path
  45.     mov ecx, 4096/4
  46.     rep movsd
  47.     mov byte [edi-1], 0
  48. @@:
  49. ; OpenDialog initialisation
  50.     push    dword OpenDialog_data
  51.     call    [OpenDialog_Init]
  52.  
  53. ; initialize keyboard handling
  54.     invoke  ini_get_shortcut, inifilename, aShortcuts, aNext, -1, next_mod
  55.     mov [next_key], eax
  56.     invoke  ini_get_shortcut, inifilename, aShortcuts, aPrev, -1, prev_mod
  57.     mov [prev_key], eax
  58.     invoke  ini_get_shortcut, inifilename, aShortcuts, aSlide, -1, slide_mod
  59.     mov [slide_key], eax
  60.     invoke  ini_get_shortcut, inifilename, aShortcuts, aTglbar, -1, tglbar_mod
  61.     mov [tglbar_key], eax
  62.     mcall   SF_KEYBOARD, SSF_SET_INPUT_MODE, 1    ; set kbd mode to scancodes
  63.  
  64.     cmp byte [@PARAMS], 0
  65.     jnz params_given
  66.  
  67.     mov [OpenDialog_data.draw_window],draw_window_fake
  68.    
  69. ; OpenDialog Open
  70.     push    dword OpenDialog_data
  71.     call    [OpenDialog_Start]
  72.  
  73.     cmp [OpenDialog_data.status],1
  74.     jne exit
  75.  
  76.     mov [OpenDialog_data.draw_window],draw_window
  77.  
  78.     mov esi, path
  79.     mov edi, @PARAMS
  80.     mov ecx, 4096/4
  81.     rep movsd
  82.     mov byte [edi-1], 0
  83.     jmp params_given
  84.  
  85. set_bgr:
  86.     mcall   SF_BACKGROUND_SET, SSF_MODE_BG
  87.     mov eax, @PARAMS + 4
  88.     call    load_image
  89.     jc  exit
  90.  
  91.     call    set_as_bgr
  92.     jmp exit
  93.  
  94. params_given:
  95.  
  96.     mov esi, @PARAMS
  97.     push    esi
  98.     call    find_last_name_component
  99.  
  100.     pop eax
  101.     call    load_image
  102.     jc  exit
  103.     call    generate_header
  104.  
  105. ;-----------------------------------------------------------------------------
  106.  
  107. red:
  108.     call    draw_window
  109.  
  110. still:
  111.     mov eax, [image]
  112.     test    byte [eax + Image.Flags], Image.IsAnimated
  113.     push    SF_WAIT_EVENT
  114.     pop eax
  115.     jz  @f
  116.     mcall   SF_SYSTEM_GET, SSF_TIME_COUNT
  117.     mov edx, [cur_frame]
  118.     mov ebx, [cur_frame_time]
  119.     add ebx, [edx + Image.Delay]
  120.     sub ebx, eax
  121.     cmp ebx, [edx + Image.Delay]
  122.     ja  red_update_frame
  123.     test    ebx, ebx
  124.     jz  red_update_frame
  125.     push    SF_WAIT_EVENT_TIMEOUT
  126.     pop eax
  127.   @@:
  128.     mcall
  129.     dec eax
  130.     js  red_update_frame
  131.     jz  red
  132.     dec eax
  133.     jnz button
  134.  
  135. key:
  136.     xor esi, esi
  137. keyloop:
  138.     mcall   SF_GET_KEY
  139.     test    al, al
  140.     jnz keyloopdone
  141.     shr eax, 8
  142.     mov ecx, eax
  143.     mcall   SF_KEYBOARD, SSF_GET_CONTROL_KEYS
  144.     mov edx, next_mod
  145.     call    check_shortcut
  146.     jz  .next
  147.     add edx, prev_mod - next_mod
  148.     call    check_shortcut
  149.     jz  .prev
  150.     add edx, slide_mod - prev_mod
  151.     call    check_shortcut
  152.     jz  .slide
  153.     add edx, tglbar_mod - slide_mod
  154.     call    check_shortcut
  155.     jz  .tglbar
  156.     cmp cl, 1 ; Esc
  157.     jz  .esc
  158.     jmp keyloop
  159. .esc:
  160.     test byte [bSlideShow], 1
  161.     jnz .slide
  162.     jmp keyloop
  163. .tglbar:
  164.     mov byte [bTglbar], 1
  165.     test byte[bSlideShow], 1
  166.     jnz @f
  167.     xor [toolbar_height], 31
  168. @@:
  169.     jmp keyloop
  170. .slide:
  171.     call slide_show
  172.     jmp keyloop
  173. .prev:
  174.     dec esi
  175.     jmp keyloop
  176. .next:
  177.     inc esi
  178.     jmp keyloop
  179. keyloopdone:
  180.     test esi, esi
  181.     jnz next_or_prev_handler
  182.     test byte [bSlideShow], 2
  183.     jnz red
  184.     test byte [bTglbar], 1
  185.     jnz red
  186.     jmp still
  187. next_or_prev_handler:
  188.     call    next_or_prev_image
  189.     jmp red
  190.  
  191. red_update_frame:
  192.     mov eax, [cur_frame]
  193.     mov eax, [eax + Image.Next]
  194.     test    eax, eax
  195.     jnz @f
  196.     mov eax, [image]
  197.   @@:
  198.     mov [cur_frame], eax
  199.     mcall   SF_SYSTEM_GET, SSF_TIME_COUNT
  200.     mov [cur_frame_time], eax
  201.     mcall   SF_THREAD_INFO, procinfo, -1
  202.     call    draw_cur_frame
  203.     jmp still
  204.  
  205. button:
  206.     mcall   SF_GET_BUTTON
  207.     shr eax, 8
  208.  
  209.     ; flip horizontally
  210.     cmp eax, 'flh'
  211.     jne @f
  212.  
  213.     invoke  img.flip, [image], FLIP_HORIZONTAL
  214.     jmp redraw_image
  215.  
  216.     ; flip vertically
  217.     @@: cmp eax, 'flv'
  218.     jne @f
  219.  
  220.     invoke  img.flip, [image], FLIP_VERTICAL
  221.     jmp redraw_image
  222.  
  223.     ; flip both horizontally and vertically
  224.     @@: cmp eax, 'flb'
  225.     jne @f
  226.  
  227.     invoke  img.flip, [image], FLIP_BOTH
  228.     jmp redraw_image
  229.  
  230.     ; rotate left
  231.     @@: cmp eax, 'rtl'
  232.     jne @f
  233.  
  234.     push    ROTATE_90_CCW
  235. .rotate_common:
  236.     invoke  img.rotate, [image]
  237.     mov eax, [image]
  238.     test    eax, eax    ; clear ZF flag
  239.     call    update_image_sizes
  240.     jmp redraw_image
  241.  
  242.     ; rotate right
  243.     @@: cmp eax, 'rtr'
  244.     jne @f
  245.  
  246.     push    ROTATE_90_CW
  247.     jmp .rotate_common
  248.  
  249.     ; open new file
  250.     @@: cmp eax, 'opn'
  251.     jne @f
  252.    
  253. ; OpenDialog Open
  254.     push    dword OpenDialog_data
  255.     call    [OpenDialog_Start]
  256.    
  257.     cmp [OpenDialog_data.status],1
  258.     jne still
  259.    
  260.     mov esi, path
  261.     mov edi, @PARAMS
  262.     push    edi
  263.     mov ecx, 4096/4
  264.     rep movsd
  265.     mov byte [edi-1], 0
  266.    
  267.     pop esi
  268.     push    esi
  269.     call    find_last_name_component
  270.  
  271.     pop eax
  272.     push    [image]
  273.     call    load_image
  274.     jc  .restore_old
  275.     call    generate_header
  276.    
  277.     invoke  img.destroy
  278.     call    free_directory
  279.     jmp red
  280.    
  281.     .restore_old:
  282.     pop [image]
  283.     call    init_frame
  284.     jmp still
  285.  
  286.     ; set background
  287.     @@:
  288.     cmp eax, 'bgr'
  289.     jne @f
  290.  
  291.         mcall   SF_BACKGROUND_SET, SSF_MODE_BG, 2 ;stretch by default
  292.     call    set_as_bgr
  293.     jmp still
  294.  
  295.     @@:
  296.     cmp eax, 'sld'
  297.     jne @f
  298.  
  299.     call    slide_show
  300.     jmp red
  301.  
  302.     @@:
  303.  
  304.     or  esi, -1
  305.     cmp eax, 'bck'
  306.     jz  next_or_prev_handler
  307.     neg esi
  308.     cmp eax, 'fwd'
  309.     jz  next_or_prev_handler
  310.  
  311.     cmp eax, 1
  312.     jne still
  313.  
  314.   exit:
  315.     mcall   SF_TERMINATE_PROCESS
  316.  
  317.   redraw_image = red
  318.  
  319. load_image:
  320.     and [img_data], 0
  321.     push    eax
  322.     invoke  file.open, eax, O_READ
  323.     or  eax, eax
  324.     jz  .error_pop
  325.     mov [fh], eax
  326.     invoke  file.size
  327.     mov [img_data_len], ebx
  328.     stdcall mem.Alloc, ebx
  329.     test    eax, eax
  330.     jz  .error_close
  331.     mov [img_data], eax
  332.     invoke  file.read, [fh], eax, [img_data_len]
  333.     cmp eax, -1
  334.     jz  .error_close
  335.     cmp eax, [img_data_len]
  336.     jnz .error_close
  337.     invoke  file.close, [fh]
  338.     inc eax
  339.     jz  .error
  340.  
  341.     invoke  img.decode, [img_data], [img_data_len], 0
  342.     or  eax, eax
  343.     jz  .error
  344.     cmp [image], 0
  345.     pushf
  346.     mov [image], eax
  347.     call    img_resize_to_screen
  348.     call    init_frame
  349.     popf
  350.     call    update_image_sizes
  351.     call    free_img_data
  352.     clc
  353.     ret
  354.  
  355. .error_free:
  356.     invoke  img.destroy, [image]
  357.     jmp .error
  358.  
  359. .error_pop:
  360.     pop eax
  361.     jmp .error
  362. .error_close:
  363.     invoke  file.close, [fh]
  364. .error:
  365.     call    free_img_data
  366.     stc
  367.     ret
  368.  
  369. align 4
  370. proc img_resize_to_screen uses eax ebx ecx edx
  371.         mov ebx, [image]
  372.         cmp     [ebx+Image.Type],Image.bpp24
  373.         jne .end_f
  374.         test [ebx+Image.Flags],Image.IsAnimated
  375.         jnz .end_f
  376.         mov eax, [ebx+Image.Data]      
  377.         mov [buf_0],eax
  378.         mov eax, [ebx+Image.Width]
  379.         mov [buf_0.w],eax
  380.         mov eax, [ebx+Image.Height]
  381.         mov [buf_0.h],eax
  382.  
  383.         mcall SF_STYLE_SETTINGS, SSF_GET_SKIN_HEIGHT
  384.         mov edx, [image_padding]
  385.         shl edx, 1
  386.         add edx, eax
  387.         mcall SF_GET_SCREEN_SIZE
  388.         mov ecx, eax
  389.         shr ecx, 17
  390.  
  391.         mov ebx, [image]
  392.         movzx eax,ax
  393.         sub eax, edx
  394.         sub eax, [toolbar_height]
  395.         sub eax, 5-1 ;5 px = border
  396.         cmp eax, 1
  397.         jle .end0
  398.         cmp eax, [ebx+Image.Height]
  399.         jl .end1
  400.         .end0:
  401.                 xor eax,eax
  402.                 jmp .end2
  403.         .end1:
  404.                 mov [ebx+Image.Height],eax
  405.         .end2:
  406.         sub ecx, [image_padding]
  407.         shl ecx, 1
  408.         sub ecx, 10-1 ;10 px = 2 borders
  409.         cmp ecx, 1
  410.         jle .end3
  411.         cmp ecx, [ebx+Image.Width]
  412.         jl .end4
  413.         .end3:
  414.                 xor ecx,ecx
  415.                 jmp .end5
  416.         .end4:
  417.                 mov [ebx+Image.Width],ecx
  418.         .end5:
  419.         cmp eax,ecx
  420.         jne @f
  421.                 test eax,eax
  422.                 jz .end_f
  423.         @@:
  424.         stdcall [buf2d_resize], buf_0, ecx, eax, 2
  425. .end_f:
  426.         ret
  427. endp
  428.  
  429. align 4
  430. free_img_data:
  431.     mov eax, [img_data]
  432.     test    eax, eax
  433.     jz  @f
  434.     stdcall mem.Free, eax
  435. @@:
  436.     ret
  437.  
  438. update_image_sizes:
  439.     pushf
  440.     mov edx, [eax + Image.Width]
  441.     test    [eax + Image.Flags], Image.IsAnimated
  442.     jnz .not_in_row
  443.     push eax
  444. @@: cmp [eax + Image.Next], 0
  445.     jz  @f
  446.     mov eax, [eax + Image.Next]
  447.     add edx, [eax + Image.Width]
  448.     inc edx
  449.     jmp @b
  450. @@: pop eax
  451. .not_in_row:
  452.     mov [draw_width], edx
  453.     add edx, 19
  454.     cmp edx, 50 + 25*numimages
  455.     jae @f
  456.     mov edx, 50 + 25*numimages
  457. @@:
  458. ;    dec edx
  459.     mov [wnd_width], edx
  460.     mov esi, [eax + Image.Height]
  461.     test    [eax + Image.Flags], Image.IsAnimated
  462.     jnz .max_equals_first
  463.     push eax
  464. @@: cmp [eax + Image.Next], 0
  465.     jz  @f
  466.     mov eax, [eax + Image.Next]
  467.     cmp esi, [eax + Image.Height]
  468.     jae @b
  469.     mov esi, [eax + Image.Height]
  470.     jmp @b
  471. @@: pop eax
  472. .max_equals_first:
  473.     mov [draw_height], esi
  474.     add esi, [toolbar_height]
  475.     add esi, [image_padding]
  476.     add esi, [image_padding]
  477.     add esi, 5  ; window bottom frame height
  478.     dec esi
  479.     mov [wnd_height], esi
  480.     popf
  481.     jz  .no_resize
  482.     test [wnd_style], 1 SHL 25
  483.     jz .no_resize
  484.     mcall   SF_STYLE_SETTINGS, SSF_GET_SKIN_HEIGHT
  485.     add esi, eax
  486.     mcall   SF_CHANGE_WINDOW,-1,-1
  487. .no_resize:
  488.     ret
  489.  
  490. set_as_bgr:
  491.     mov esi, [image]
  492.     mov ecx, [esi + Image.Width]
  493.     mov edx, [esi + Image.Height]
  494.     mcall   SF_BACKGROUND_SET, SSF_SIZE_BG
  495.  
  496.     mcall   SF_BACKGROUND_SET, SSF_MAP_BG
  497.     test    eax, eax
  498.     jz  @f
  499.  
  500.     push    eax
  501.     invoke  img.to_rgb2, esi, eax
  502.     pop ecx
  503.     mcall   SF_BACKGROUND_SET, SSF_UNMAP_BG
  504.  
  505. @@:
  506.     mcall   SF_BACKGROUND_SET, SSF_REDRAW_BG
  507.  
  508.         ;save to file eskin.ini
  509.         xor al,al
  510.         mov ecx,1024
  511.         mov edi,sys_path+2
  512.         repne scasb
  513.         sub edi,sys_path+3
  514.         invoke  ini_set_str, inifileeskin, amain, aprogram, sys_path+2, edi
  515.         ;add param '\S__'
  516.     cmp word[@PARAMS],'\T'
  517.     je @f
  518.         cmp word[@PARAMS],'\S'
  519.         je @f
  520.         mov esi, @PARAMS+4096-8
  521.     mov edi, @PARAMS+4096-4
  522.     mov ecx, 4096/4-1
  523.         std
  524.     rep movsd
  525.         cld
  526.         mov dword[@PARAMS],'\S__'
  527.         @@:
  528.         ;
  529.         xor al,al
  530.         mov ecx,4096
  531.         mov edi,@PARAMS
  532.         repne scasb
  533.         sub edi,@PARAMS+1
  534.         invoke  ini_set_str, inifileeskin, amain, aparam, @PARAMS, edi
  535.     ret
  536.  
  537. slide_show:
  538.     or  byte [bSlideShow], 2
  539.     xor byte [bSlideShow], 1
  540.     btc dword [wnd_style], 25
  541.     jc  @f
  542.     mov eax, [toolbar_height_old]
  543.     mov [toolbar_height], eax
  544.     mov [image_padding], 5
  545.     jmp .toolbar_height_done
  546. @@:
  547.     mov eax, [toolbar_height]
  548.     mov [toolbar_height_old], eax
  549.     mov [toolbar_height], 0
  550.     mov [image_padding], 0
  551. .toolbar_height_done:
  552.     ret
  553.  
  554. ; seek to ESI image files
  555. ; esi>0 means next file, esi<0 - prev file
  556. next_or_prev_image:
  557.     push    esi
  558.     call    load_directory
  559.     pop esi
  560.     mov ebx, [directory_ptr]
  561.     test    ebx, ebx
  562.     jz  .ret
  563.     cmp dword[ebx+4], 0
  564.     jz  .ret
  565.     mov eax, [cur_file_idx]
  566.     cmp eax, -1
  567.     jnz @f
  568.     test    esi, esi
  569.     jns @f
  570.     mov eax, [ebx+4]
  571. @@:
  572.     push    [image]
  573.     add eax, esi
  574. @@:
  575.     test    eax, eax
  576.     jns @f
  577.     add eax, [ebx+4]
  578.     jmp @b
  579. @@:
  580.     cmp eax, [ebx+4]
  581.     jb  @f
  582.     sub eax, [ebx+4]
  583.     jmp @b
  584. @@:
  585.     push    eax
  586. .scanloop:
  587.     push    eax ebx esi
  588.     imul    esi, eax, 304
  589.     add esi, [directory_ptr]
  590.     add esi, 32 + 40
  591.     mov edi, curdir
  592. @@:
  593.     inc edi
  594.     cmp byte [edi-1], 0
  595.     jnz @b
  596.     mov byte [edi-1], '/'
  597. @@:
  598.     lodsb
  599.     stosb
  600.     test    al, al
  601.     jnz @b
  602.     mov eax, curdir
  603.     call    load_image
  604.     pushf
  605.     mov esi, curdir
  606.     push    esi
  607.     mov edi, @PARAMS
  608.     mov ecx, 4096/4
  609.     rep movsd
  610.     mov byte [edi-1], 0
  611.     pop esi
  612. @@:
  613.     lodsb
  614.     test    al, al
  615.     jnz @b
  616. @@:
  617.     dec esi
  618.     cmp byte [esi], '/'
  619.     jnz @b
  620.     mov byte [esi], 0
  621.     popf
  622.     pop esi ebx eax
  623.     jnc .loadedok
  624.     test    esi, esi
  625.     js  .try_prev
  626. .try_next:
  627.     inc eax
  628.     cmp eax, [ebx+4]
  629.     jb  @f
  630.     xor eax, eax
  631. @@:
  632. .try_common:
  633.     cmp eax, [esp]
  634.     jz  .notfound
  635.     jmp .scanloop
  636. .try_prev:
  637.     dec eax
  638.     jns @f
  639.     mov eax, [ebx+4]
  640.     dec eax
  641. @@:
  642.     jmp .try_common
  643. .loadedok:
  644.     mov [cur_file_idx], eax
  645.     pop eax
  646.     invoke  img.destroy
  647.     call    generate_header
  648. .ret:
  649.     ret
  650. .notfound:
  651.     pop eax
  652.     pop [image]
  653.     call    init_frame
  654.     ret
  655.  
  656. load_directory:
  657.     cmp [directory_ptr], 0
  658.     jnz .ret
  659.     mov esi, @PARAMS
  660.     mov edi, curdir
  661.     mov ecx, [last_name_component]
  662.     sub ecx, esi
  663.     dec ecx
  664.     js  @f
  665.     rep movsb
  666. @@:
  667.     mov byte [edi], 0
  668.     mcall   SF_SYS_MISC, SSF_MEM_ALLOC, 0x1000
  669.     test    eax, eax
  670.     jz  .ret
  671.     mov ebx, readdir_fileinfo
  672.     mov dword [ebx+12], (0x1000 - 32) / 304
  673.     mov dword [ebx+16], eax
  674.     mcall   SF_FILE
  675.     cmp eax, 6
  676.     jz  .dirok
  677.     test    eax, eax
  678.     jnz free_directory
  679.     mov edx, [directory_ptr]
  680.     mov ecx, [edx+8]
  681.     mov [readblocks], ecx
  682.     imul    ecx, 304
  683.     add ecx, 32
  684.     mcall   SF_SYS_MISC, SSF_MEM_REALLOC
  685.     test    eax, eax
  686.     jz  free_directory
  687.     mov [directory_ptr], eax
  688.     mcall   SF_FILE, readdir_fileinfo
  689. .dirok:
  690.     cmp ebx, 0
  691.     jle free_directory
  692.     mov eax, [directory_ptr]
  693.     add eax, 32
  694.     mov edi, eax
  695.     push    0
  696. .dirskip:
  697.     push    eax
  698.     test    byte [eax], 18h
  699.     jnz .nocopy
  700.     lea esi, [eax+40]
  701.     mov ecx, esi
  702. @@:
  703.     lodsb
  704.     test    al, al
  705.     jnz @b
  706. @@:
  707.     dec esi
  708.     cmp esi, ecx
  709.     jb  .noext
  710.     cmp byte [esi], '.'
  711.     jnz @b
  712.     inc esi
  713.     mov ecx, [esi]
  714.     cmp byte[esi+3], 0
  715.     jne .not_3
  716.     or  ecx, 0x202020
  717.     cmp ecx, 'jpg'
  718.     jz  .copy
  719.     cmp ecx, 'bmp'
  720.     jz  .copy
  721.     cmp ecx, 'gif'
  722.     jz  .copy
  723.     cmp ecx, 'png'
  724.     jz  .copy
  725.     cmp ecx, 'jpe'
  726.     jz  .copy
  727.     cmp ecx, 'ico'
  728.     jz  .copy
  729.     cmp ecx, 'cur'
  730.     jz  .copy
  731.     cmp ecx, 'tga'
  732.     jz  .copy
  733.     cmp ecx, 'pcx'
  734.     jz  .copy
  735.     cmp ecx, 'xcf'
  736.     jz  .copy
  737.     cmp ecx, 'pbm'
  738.     jz  .copy
  739.     cmp ecx, 'pgm'
  740.     jz  .copy
  741.     cmp ecx, 'pnm'
  742.     jz  .copy
  743.     cmp ecx, 'tif'
  744.     jz  .copy
  745.   .not_3:
  746.     cmp byte[esi+4], 0
  747.     jne .nocopy
  748.     or  ecx, 0x20202020
  749.     cmp ecx, 'tiff'
  750.     jz  @f
  751.     cmp ecx, 'wbmp'
  752.     jz  @f
  753.     cmp ecx, 'jpeg'
  754.     jnz .nocopy
  755. @@:
  756.     cmp byte [esi+4], 0
  757.     jnz .nocopy
  758. .copy:
  759.     mov esi, [esp]
  760.     mov ecx, 304 / 4
  761.     rep movsd
  762.     inc dword [esp+4]
  763. .nocopy:
  764. .noext:
  765.     pop eax
  766.     add eax, 304
  767.     dec ebx
  768.     jnz .dirskip
  769.     mov eax, [directory_ptr]
  770.     pop ebx
  771.     mov [eax+4], ebx
  772.     test    ebx, ebx
  773.     jz  free_directory
  774.     push    0   ; sort mode
  775.     push    ebx
  776.     add eax, 32
  777.     push    eax
  778.     call    [SortDir]
  779.     xor eax, eax
  780.     mov edi, [directory_ptr]
  781.     add edi, 32 + 40
  782. .scan:
  783.     mov esi, [last_name_component]
  784.     push    edi
  785.     invoke  strcmpi
  786.     pop edi
  787.     jz  .found
  788.     inc eax
  789.     add edi, 304
  790.     dec ebx
  791.     jnz .scan
  792.     or  eax, -1
  793. .found:
  794.     mov [cur_file_idx], eax
  795. .ret:
  796.     ret
  797.  
  798. free_directory:
  799.     mcall   SF_SYS_MISC, SSF_MEM_FREE, [directory_ptr]
  800.     and [directory_ptr], 0
  801.     ret
  802.  
  803. ; in: esi->full name (e.g. /path/to/file.png)
  804. ; out: [last_name_component]->last component (e.g. file.png)
  805. find_last_name_component:
  806.     mov ecx, esi
  807. @@:
  808.     lodsb
  809.     test    al, al
  810.     jnz @b
  811. @@:
  812.     dec esi
  813.     cmp esi, ecx
  814.     jb  @f
  815.     cmp byte [esi], '/'
  816.     jnz @b
  817. @@:
  818.     inc esi
  819.     mov [last_name_component], esi
  820.     ret
  821.  
  822. init_frame:
  823.     push    eax
  824.     mov eax, [image]
  825.     mov [cur_frame], eax
  826.     test    byte [eax + Image.Flags], Image.IsAnimated
  827.     jz  @f
  828.     push    ebx
  829.     mcall   SF_SYSTEM_GET, SSF_TIME_COUNT
  830.     pop ebx
  831.     mov [cur_frame_time], eax
  832. @@:
  833.     pop eax
  834.     ret
  835.  
  836. draw_window:
  837.     btr  word [bSlideShow], 1  ; mode changed
  838.     jc .mode_changed
  839.     test byte [bTglbar], 1
  840.     jz .mode_not_changed
  841. .mode_changed:
  842.     test [wnd_style], 1 SHL 25
  843.     jz .mode_slide
  844.     mov [bg_color], 0x00ffffff
  845.     mov eax, [image]
  846.     cmp eax, eax
  847.     call update_image_sizes
  848.     mcall SF_STYLE_SETTINGS, SSF_GET_SKIN_HEIGHT
  849.     mov esi, [wnd_height]
  850.     add esi, eax
  851.     test byte [bTglbar], 1
  852.     jz @f
  853.     mcall SF_CHANGE_WINDOW, -1, -1, [wnd_width],
  854.     jmp .mode_not_changed
  855. @@:
  856.     mcall SF_CHANGE_WINDOW, [wnd_x], [wnd_y], [wnd_width],
  857.     jmp .mode_not_changed
  858. .mode_slide:
  859.     mov [bg_color], 0x00000000
  860.     mov eax, [procinfo.box.left]
  861.     mov [wnd_x], eax
  862.     mov eax, [procinfo.box.top]
  863.     mov [wnd_y], eax
  864.     mcall SF_GET_SCREEN_SIZE
  865.     mov edx, eax
  866.     shr edx, 16
  867.     movzx eax, ax
  868.     mov esi, eax
  869.     mcall SF_CHANGE_WINDOW, 0, 0, ,
  870.     jmp .posok.slide_show
  871.  
  872. .mode_not_changed:
  873.     cmp [bFirstDraw], 0
  874.     jz  .posok
  875.     or  ecx, -1
  876.     mcall   SF_THREAD_INFO, procinfo
  877.  
  878.     test byte [procinfo.wnd_state], 0x04
  879.     jnz .posok
  880.  
  881.     mov edx, ecx
  882.     mov esi, ecx
  883.     cmp dword [procinfo.box.width], 50 + 25 * numimages
  884.     jae @f
  885.     mov edx, 50 + 25 * numimages
  886. @@:
  887.     cmp dword [procinfo.box.height], 70
  888.     jae @f
  889.     mov esi, 70
  890. @@:
  891.     mov eax, edx
  892.     and eax, esi
  893.     cmp eax, -1
  894.     jz  @f
  895.     mov ebx, ecx
  896.     mcall   SF_CHANGE_WINDOW
  897. @@:
  898.  
  899. .posok:
  900.     test [wnd_style], 1 SHL 25
  901.     jz .posok.slide_show
  902.     mcall   SF_REDRAW, SSF_BEGIN_DRAW
  903.     mcall   SF_STYLE_SETTINGS, SSF_GET_SKIN_HEIGHT
  904.     mov ebp, eax    ; save skin height
  905.     add eax, [wnd_height]
  906.     mov ebx, [wnd_x]
  907.     shl ebx, 16
  908.     add ebx, [wnd_width]
  909.     mov ecx, [wnd_y]
  910.     shl ecx, 16
  911.     add ecx, eax
  912.     mcall   SF_CREATE_WINDOW, , , [wnd_style], 0, real_header
  913.     jmp .posok.common
  914. .posok.slide_show:
  915.     mcall   SF_REDRAW, SSF_BEGIN_DRAW
  916.     mcall SF_GET_SCREEN_SIZE
  917.     mov ebx, eax
  918.     shr ebx, 16
  919.     movzx eax, ax
  920.     mov ecx, eax
  921.     mcall   SF_CREATE_WINDOW, , , [wnd_style], 0, real_header
  922. .posok.common:
  923.     mcall   SF_THREAD_INFO, procinfo, -1
  924.     mov eax, [procinfo.client_box.width]
  925.     sub eax, [image_padding]
  926.     sub eax, [image_padding]
  927.     sub eax, [draw_width]
  928.     sar eax, 1
  929.     test eax, eax
  930.     jns @f
  931.     mov eax, 0
  932. @@:
  933.     add eax, [image_padding]
  934.     mov [draw_x], eax
  935.     mov eax, [procinfo.client_box.height]
  936.     sub eax, [toolbar_height]
  937.     sub eax, [image_padding]
  938.     sub eax, [image_padding]
  939.     sub eax, [draw_height]
  940.     sar eax, 1
  941.     test eax, eax
  942.     jns @f
  943.     mov eax, 0
  944. @@:
  945.     add eax, [toolbar_height]
  946.     add eax, [image_padding]
  947.     mov [draw_y], eax
  948.     mov [bFirstDraw], 1
  949.     cmp dword [procinfo.client_box.height], 0
  950.     jle .nodraw
  951.     mov ebx, [procinfo.client_box.width]
  952.     inc ebx
  953.     mov ecx, [draw_y]
  954.     mcall   SF_DRAW_RECT, , , [bg_color]
  955.     mov ecx, [procinfo.client_box.height]
  956.     inc ecx
  957.     mov esi, [cur_frame]
  958.     mov esi, [esi + Image.Height]
  959.     add esi, [draw_y]
  960.     sub ecx, esi
  961.     jbe @f
  962.     push    esi
  963.     shl esi, 16
  964.     add ecx, esi
  965.     pop esi
  966.     mcall
  967.     xor ecx, ecx
  968. @@:
  969.     add ecx, esi
  970.     mov ebx, [draw_y]
  971.     sub ecx, ebx
  972.     shl ebx, 16
  973.     add ecx, ebx
  974.     mov ebx, [draw_x]
  975.     mcall
  976.     mov esi, [cur_frame]
  977.     mov esi, [esi + Image.Width]
  978.     add esi, ebx
  979.     mov ebx, [procinfo.client_box.width]
  980.     inc ebx
  981.     sub ebx, esi
  982.     jbe @f
  983.     shl esi, 16
  984.     add ebx, esi
  985.     mcall
  986. @@:
  987.  
  988.     test [wnd_style], 1 SHL 25
  989.     jz .slide_show_mode
  990.     mov byte [bTglbar], 0
  991.     cmp byte [toolbar_height], 0
  992.     je .decorations_done
  993.     mov ebx, [procinfo.client_box.width]
  994.     push    ebx
  995.     mcall   SF_DRAW_LINE, , <30, 30>, 0x007F7F7F
  996.     mcall   , <5 + 25 * 1, 5 + 25 * 1>, <0, 30>
  997.     mcall   , <10 + 25 * 3, 10 + 25 * 3>
  998.     mcall   , <15 + 25 * 5, 15 + 25 * 5>
  999.     pop ebx
  1000.     sub ebx, 25 * 5 + 10
  1001.     push    ebx
  1002.     imul    ebx, 10001h
  1003.     mcall
  1004.  
  1005.     mcall   SF_DEFINE_BUTTON, <4 + 25 * 0, 21>, <4, 21>, 'opn'+40000000h
  1006.     mcall   , <9 + 25 * 1, 21>, , 'bck'+40000000h
  1007.     mcall   , <9 + 25 * 2, 21>, , 'fwd'+40000000h
  1008.     mcall   , <14 + 25 * 3, 21>, , 'bgr'+40000000h
  1009.     mcall   , <14 + 25 * 4, 21>, , 'sld'+40000000h
  1010.     pop ebx
  1011.     add ebx, 5
  1012.     shl ebx, 16
  1013.     mov bl, 21
  1014.     mcall   , , , 'flh'+40000000h
  1015.     add ebx, 25 * 65536
  1016.     mcall   , , , 'flv'+40000000h
  1017.     add ebx, 30 * 65536
  1018.     mcall   , , , 'rtr'+40000000h
  1019.     add ebx, 25 * 65536
  1020.     mcall   , , , 'rtl'+40000000h
  1021.     add ebx, 25 * 65536
  1022.     mcall   , , , 'flb'+40000000h
  1023.  
  1024.     mov ebp, (numimages-1)*20
  1025.  
  1026.     mcall   SF_PUT_IMAGE_EXT, buttons+openbtn*20, <20, 20>, <5 + 25 * 0, 5>, 8, palette
  1027.     mcall   , buttons+backbtn*20,    , <10 + 25 * 1, 5>
  1028.     mcall   , buttons+forwardbtn*20, , <10 + 25 * 2, 5>
  1029.     mcall   , buttons+bgrbtn*20,     , <15 + 25 * 3, 5>
  1030.     mcall   , buttons+slidebtn*20,   , <15 + 25 * 4, 5>
  1031.     mov edx, [procinfo.client_box.width]
  1032.     sub edx, 25 * 5 + 4
  1033.     shl edx, 16
  1034.     mov dl, 5
  1035.     mcall   , buttons+fliphorzbtn*20
  1036.     add edx, 25 * 65536
  1037.     mcall   , buttons+flipvertbtn*20
  1038.     add edx, 30 * 65536
  1039.     mcall   , buttons+rotcwbtn*20
  1040.     add edx, 25 * 65536
  1041.     mcall   , buttons+rotccwbtn*20
  1042.     add edx, 25 * 65536
  1043.     mcall   , buttons+rot180btn*20
  1044.     jmp .decorations_done
  1045.  
  1046. .slide_show_mode:
  1047.  
  1048. .decorations_done:
  1049.     call    draw_cur_frame
  1050.  
  1051. .nodraw:
  1052.     mcall   SF_REDRAW, SSF_END_DRAW
  1053.  
  1054.     ret
  1055.  
  1056. draw_cur_frame:
  1057.     push    0   ; ypos
  1058.     push    0   ; xpos
  1059.     mov eax, [procinfo.client_box.height]
  1060.     sub eax, [toolbar_height]
  1061.     sub eax, [image_padding]
  1062.     inc eax
  1063.     push    eax ; max height
  1064.     mov eax, [procinfo.client_box.width]
  1065.     sub eax, [image_padding]
  1066.     inc eax
  1067.     push    eax ; max width
  1068.     push [draw_y]
  1069.     push [draw_x]
  1070.     push    [cur_frame]
  1071.     call    [img.draw]
  1072.     mov eax, [image]
  1073.     test    [eax + Image.Flags], Image.IsAnimated
  1074.     jnz .done
  1075.     cmp [eax + Image.Next], 0
  1076.     jnz .additional_frames
  1077. .done:
  1078.     ret
  1079. .additional_frames:
  1080.     mov ebx, [procinfo.client_box.width]
  1081.     sub ebx, [image_padding]
  1082.     inc ebx
  1083.     jbe .done
  1084.     mov esi, [draw_x]
  1085. .afloop:
  1086.     sub ebx, [eax + Image.Width]
  1087.     jbe .done
  1088.     dec ebx
  1089.     jz  .done
  1090.     add esi, [eax + Image.Width]
  1091.     mov eax, [eax + Image.Next]
  1092.     push    eax
  1093.     inc esi
  1094.     push    0   ; ypos
  1095.     push    0   ; xpos
  1096.     mov ecx, [procinfo.client_box.height]
  1097.     sub ecx, [toolbar_height]
  1098.     sub ecx, [image_padding]
  1099.     inc ecx
  1100. ;    inc ebx
  1101.     push    ecx ; max height
  1102.     push    ebx ; max width
  1103.     push    [draw_y]  ; y
  1104.     push    esi ; x
  1105.     push    eax ; image
  1106.     call    [img.draw]
  1107.     pop eax
  1108.     cmp [eax + Image.Next], 0
  1109.     jnz .afloop
  1110.     ret
  1111.  
  1112.  
  1113. check_shortcut:
  1114. ; in:   cl = scancode (from sysfn 2),
  1115. ;   eax = state of modifiers (from sysfn 66.3),
  1116. ;   edx -> shortcut descriptor
  1117. ; out:  ZF set <=> fail
  1118.     cmp cl, [edx+4]
  1119.     jnz .not
  1120.     push    eax
  1121.     mov esi, [edx]
  1122.     and esi, 0xF
  1123.     and al, 3
  1124.     call    dword [check_modifier_table+esi*4]
  1125.     test    al, al
  1126.     pop eax
  1127.     jnz .not
  1128.     push    eax
  1129.     mov esi, [edx]
  1130.     shr esi, 4
  1131.     and esi, 0xF
  1132.     shr al, 2
  1133.     and al, 3
  1134.     call    dword [check_modifier_table+esi*4]
  1135.     test    al, al
  1136.     pop eax
  1137.     jnz .not
  1138.     push    eax
  1139.     mov esi, [edx]
  1140.     shr esi, 8
  1141.     and esi, 0xF
  1142.     shr al, 4
  1143.     and al, 3
  1144.     call    dword [check_modifier_table+esi*4]
  1145.     test    al, al
  1146.     pop eax
  1147. ;   jnz .not
  1148. .not:
  1149.     ret
  1150.  
  1151. check_modifier_0:
  1152.     setnz   al
  1153.     ret
  1154. check_modifier_1:
  1155.     setp    al
  1156.     ret
  1157. check_modifier_2:
  1158.     cmp al, 3
  1159.     setnz   al
  1160.     ret
  1161. check_modifier_3:
  1162.     cmp al, 1
  1163.     setnz   al
  1164.     ret
  1165. check_modifier_4:
  1166.     cmp al, 2
  1167.     setnz   al
  1168.     ret
  1169.  
  1170. ; fills real_header with window title
  1171. ; window title is generated as '<filename> - Kolibri Image Viewer'
  1172. generate_header:
  1173.     push    eax
  1174.     mov esi, [last_name_component]
  1175.     mov edi, real_header
  1176. @@:
  1177.     lodsb
  1178.     test    al, al
  1179.     jz  @f
  1180.     stosb
  1181.     cmp edi, real_header+256
  1182.     jb  @b
  1183. .overflow:
  1184.     mov dword [edi-4], '...'
  1185. .ret:
  1186.     pop eax
  1187.     ret
  1188. @@:
  1189.     mov esi, s_header
  1190. @@:
  1191.     lodsb
  1192.     stosb
  1193.     test    al, al
  1194.     jz  .ret
  1195.     cmp edi, real_header+256
  1196.     jb  @b
  1197.     jmp .overflow
  1198. ;-----------------------------------------------------------------------------
  1199.  
  1200. s_header db ' - Kolibri Image Viewer', 0
  1201. wnd_style        dd 0x73FFFFFF
  1202. wnd_x            dd 100
  1203. wnd_y            dd 100
  1204. image_padding    dd 5
  1205. toolbar_height   dd 31
  1206. bg_color         dd 0x00ffffff
  1207.  
  1208. ;-----------------------------------------------------------------------------
  1209. ;-----------------------------------------------------------------------------
  1210.  
  1211. align 4
  1212. @IMPORT:
  1213.  
  1214. library             \
  1215.     libio  , 'libio.obj'  , \
  1216.     libgfx , 'libgfx.obj' , \
  1217.     libimg , 'libimg.obj' , \
  1218.     libini , 'libini.obj' , \
  1219.     sort   , 'sort.obj'   , \
  1220.     proc_lib ,'proc_lib.obj',\
  1221.         libbuf2d, 'buf2d.obj'
  1222.  
  1223.  
  1224. import  libio             , \
  1225.     libio.init , 'lib_init'   , \
  1226.     file.size  , 'file_size'  , \
  1227.     file.open  , 'file_open'  , \
  1228.     file.read  , 'file_read'  , \
  1229.     file.close , 'file_close'
  1230.  
  1231. import  libgfx              , \
  1232.     libgfx.init   , 'lib_init'  , \
  1233.     gfx.open      , 'gfx_open'  , \
  1234.     gfx.close     , 'gfx_close' , \
  1235.     gfx.pen.color , 'gfx_pen_color' , \
  1236.     gfx.line      , 'gfx_line'
  1237.  
  1238. import  libimg             , \
  1239.     libimg.init , 'lib_init'   , \
  1240.     img.is_img  , 'img_is_img' , \
  1241.     img.to_rgb2 , 'img_to_rgb2', \
  1242.     img.decode  , 'img_decode' , \
  1243.     img.flip    , 'img_flip'   , \
  1244.     img.rotate  , 'img_rotate' , \
  1245.     img.destroy , 'img_destroy', \
  1246.     img.draw    , 'img_draw'
  1247.  
  1248. import  libini, \
  1249.     ini_get_shortcut, 'ini_get_shortcut',\
  1250.         ini_set_str, 'ini_set_str'
  1251.  
  1252. import  sort, sort.START, 'START', SortDir, 'SortDir', strcmpi, 'strcmpi'
  1253.  
  1254. import  proc_lib, \
  1255.     OpenDialog_Init, 'OpenDialog_init', \
  1256.     OpenDialog_Start,'OpenDialog_start'
  1257.  
  1258. import  libbuf2d, \
  1259.         buf2d_init, 'lib_init', \
  1260.         buf2d_resize, 'buf2d_resize'
  1261.  
  1262. align 4
  1263. buf_0: dd 0
  1264.         dw 0,0
  1265. .w: dd 0
  1266. .h: dd 0,0
  1267.         db 24 ;+20 bit in pixel
  1268.  
  1269. bFirstDraw  db  0
  1270. bSlideShow  db  0
  1271. bTglbar     db  0
  1272. ;-----------------------------------------------------------------------------
  1273.  
  1274. virtual at 0
  1275. file 'kivicons.bmp':0xA,4
  1276. load offbits dword from 0
  1277. end virtual
  1278. numimages = 10
  1279. openbtn = 0
  1280. backbtn = 1
  1281. forwardbtn = 2
  1282. bgrbtn = 3
  1283. fliphorzbtn = 4
  1284. flipvertbtn = 5
  1285. rotcwbtn = 6
  1286. rotccwbtn = 7
  1287. rot180btn = 8
  1288. slidebtn = 9
  1289.  
  1290. palette:
  1291.     file 'kivicons.bmp':0x36,offbits-0x36
  1292. buttons:
  1293.     file 'kivicons.bmp':offbits
  1294. repeat 10
  1295. y = % - 1
  1296. z = 20 - %
  1297. repeat numimages*5
  1298. load a dword from $ - numimages*20*20 + numimages*20*y + (%-1)*4
  1299. load b dword from $ - numimages*20*20 + numimages*20*z + (%-1)*4
  1300. store dword a at $ - numimages*20*20 + numimages*20*z + (%-1)*4
  1301. store dword b at $ - numimages*20*20 + numimages*20*y + (%-1)*4
  1302. end repeat
  1303. end repeat
  1304.  
  1305. inifilename db  '/sys/settings/app.ini',0
  1306. aShortcuts  db  'Kiv',0
  1307. aNext       db  'Next',0
  1308. aPrev       db  'Prev',0
  1309. aSlide      db  'SlideShow',0
  1310. aTglbar     db  'ToggleBar',0
  1311.  
  1312. inifileeskin db '/sys/settings/eskin.ini',0
  1313. amain       db 'main',0
  1314. aprogram    db 'program',0
  1315. aparam      db 'param',0
  1316.  
  1317. align 4
  1318. check_modifier_table:
  1319.     dd  check_modifier_0
  1320.     dd  check_modifier_1
  1321.     dd  check_modifier_2
  1322.     dd  check_modifier_3
  1323.     dd  check_modifier_4
  1324.  
  1325. ;---------------------------------------------------------------------
  1326. align 4
  1327. OpenDialog_data:
  1328. .type           dd 0
  1329. .procinfo       dd procinfo ;+4
  1330. .com_area_name      dd communication_area_name ;+8
  1331. .com_area       dd 0 ;+12
  1332. .opendir_pach       dd temp_dir_pach ;+16
  1333. .dir_default_pach   dd communication_area_default_pach ;+20
  1334. .start_path     dd open_dialog_path ;+24
  1335. .draw_window        dd draw_window ;+28
  1336. .status         dd 0 ;+32
  1337. .openfile_pach      dd path  ;openfile_pach ;+36
  1338. .filename_area      dd 0    ;+40
  1339. .filter_area        dd Filter
  1340. .x:
  1341. .x_size                 dw 420 ;+48 ; Window X size
  1342. .x_start                dw 10 ;+50 ; Window X position
  1343. .y:
  1344. .y_size                 dw 320 ;+52 ; Window y size
  1345. .y_start                dw 10 ;+54 ; Window Y position
  1346.  
  1347. communication_area_name:
  1348.     db 'FFFFFFFF_open_dialog',0
  1349.  
  1350. open_dialog_path:
  1351. if __nightbuild eq yes
  1352.     db '/sys/MANAGERS/opendial',0
  1353. else
  1354.     db '/sys/File Managers/opendial',0
  1355. end if
  1356. communication_area_default_pach:
  1357.     db '/rd/1',0
  1358.  
  1359. Filter:
  1360. dd Filter.end - Filter
  1361. .1:
  1362. db 'BMP',0
  1363. db 'GIF',0
  1364. db 'JPG',0
  1365. db 'JPEG',0
  1366. db 'JPE',0
  1367. db 'PNG',0
  1368. db 'ICO',0
  1369. db 'CUR',0
  1370. db 'TGA',0
  1371. db 'PCX',0
  1372. db 'XCF',0
  1373. db 'PBM',0
  1374. db 'PGM',0
  1375. db 'PNM',0
  1376. db 'TIF',0
  1377. db 'TIFF',0
  1378. db 'WBMP',0
  1379. .end:
  1380. db 0
  1381.  
  1382. draw_window_fake:
  1383.     ret
  1384. ;------------------------------------------------------------------------------
  1385. readdir_fileinfo:
  1386.     dd  1
  1387.     dd  0
  1388.     dd  0
  1389. readblocks dd   0
  1390. directory_ptr   dd  0
  1391. ;------------------------------------------------------------------------------
  1392. I_END:
  1393. curdir      rb  1024
  1394.  
  1395. align 4
  1396. img_data     dd ?
  1397. img_data_len dd ?
  1398. fh       dd ?
  1399. image        dd ?
  1400. wnd_width   dd  100
  1401. wnd_height  dd  100
  1402. draw_x      dd  ?
  1403. draw_y      dd  ?
  1404. draw_width  dd  ?
  1405. draw_height dd  ?
  1406. last_name_component dd  ?
  1407. cur_file_idx    dd  ?
  1408. cur_frame_time  dd  ?
  1409. cur_frame   dd  ?
  1410.  
  1411. next_mod    dd  ?
  1412. next_key    dd  ?
  1413. prev_mod    dd  ?
  1414. prev_key    dd  ?
  1415. slide_mod   dd  ?
  1416. slide_key   dd  ?
  1417. tglbar_mod  dd  ?
  1418. tglbar_key  dd  ?
  1419.  
  1420. toolbar_height_old   rd 1
  1421.  
  1422. procinfo    process_information
  1423. align 16
  1424. path:       rb  4096  ;1024+16
  1425. real_header rb  256
  1426. @PARAMS rb 4096  ;512
  1427. ;---------------------------------------------------------------------
  1428. sys_path rb 1024
  1429. temp_dir_pach:
  1430.         rb 4096
  1431. ;---------------------------------------------------------------------
  1432.     rb 4096
  1433. stacktop:
  1434. ;---------------------------------------------------------------------
  1435. F_END:
  1436.