Subversion Repositories Kolibri OS

Rev

Rev 135 | Go to most recent revision | Blame | Last modification | View Log | Download | RSS feed

  1. ;   Picture browser by lisovin@26.ru
  2. ;   Modified by Ivan Poddubny - v.0.3
  3. ;   Modified by Diamond - v.0.4
  4. ;   Compile with FASM for Menuet
  5.  
  6. ;******************************************************************************
  7.     use32
  8.     org    0x0
  9.     db     'MENUET01'              ; 8 byte id
  10.     dd     0x01                    ; header version
  11.     dd     START                   ; start of code
  12.     dd     IM_END                  ; size of image
  13.     dd     0x300000                ; memory for app
  14.     dd     0x300000                ; esp
  15.     dd     temp_area , 0x0         ; I_Param , I_Icon
  16.  
  17. include    'lang.inc'
  18. include    'macros.inc'
  19. ;******************************************************************************
  20.  
  21. START:                          ; start of execution
  22.  
  23. ; check for parameters
  24.    cmp   dword [temp_area],'BOOT'
  25.    jne   .no_boot
  26.    call  load_image
  27.    call  convert
  28.    call  background
  29.    or    eax,-1
  30.    int   0x40
  31.  .no_boot:
  32.  
  33.    cmp   byte [temp_area],0
  34.    jz    .no_param
  35.    mov   edi,string      ; clear string
  36.    mov   ecx,256/4       ;   length of a string
  37.    xor   eax,eax         ;   symbol <0>
  38.    rep   stosd
  39.  
  40.    mov   edi,temp_area   ; look for <0> in temp_area
  41.    mov   esi,edi
  42.    mov   ecx,257         ;   strlen
  43.    repne scasb
  44.         lea     ecx, [edi-temp_area]
  45.  
  46.    mov   edi,string
  47.    rep   movsb           ; copy string from temp_area to "string" (filename)
  48.  
  49.    call  load_image
  50.    call  convert
  51.  
  52.  .no_param:
  53.  
  54.  
  55.    mov  ecx,-1           ; get information about me
  56.    call getappinfo
  57.  
  58.    mov  edx,[process_info+30] ; ⥯¥àì ¢ edx ­ è ¨¤¥­â¨ä¨ª â®à
  59.    mov  ecx,eax
  60.  
  61.   @@:
  62.    call getappinfo
  63.    cmp  edx,[process_info+30]
  64.    je   @f  ; ¥á«¨ ­ è PID ᮢ¯ « á PID à áᬠâਢ ¥¬®£® ¯à®æ¥áá , ¬ë ­ è«¨ ᥡï
  65.    dec  ecx ; ¨­ ç¥ ᬮâਬ á«¥¤ãî騩 ¯à®æ¥áá
  66.    jne  @b  ; ¢®§¢à é ¥¬áï, ¥á«¨ ­¥ ¢á¥ ¯à®æ¥ááë à áᬮâ७ë
  67.   @@:
  68.  
  69. ; ⥯¥àì ¢ ecx ­®¬¥à ¯à®æ¥áá 
  70.     mov  [process],ecx
  71.  
  72. draw_still:
  73.     call draw_window
  74.  
  75. still:
  76.  
  77.     mov  eax,10                 ; wait here for event
  78.     int  0x40
  79.  
  80.         dec     eax
  81.         jz      red
  82.         dec     eax
  83.         jnz     button
  84.  
  85.   key:                          ; key
  86.     mov  al,2
  87.     int  0x40
  88.     mov  al,ah
  89.     cmp  al,6
  90.     je   kfile
  91.     cmp  al,15
  92.     je   kopen
  93.     cmp  al,9
  94.     je   kinfo
  95.     cmp  al,2
  96.     je   kbgrd
  97.     jmp  still
  98.  
  99.   red:
  100.         test    byte [status], 4
  101.         jz      draw_still
  102.         mov     al, 18
  103.         mov     ebx, 3
  104.         mov     ecx, [process]
  105.         int     0x40
  106.         and     byte [status], not 4
  107.         jmp     still
  108.  
  109.   button:                       ; button
  110.     mov  eax,17                 ; get id
  111.     int  0x40
  112.  
  113.     cmp  ah,1                   ; button id=1 ?
  114.     jne  noclose
  115.  
  116.     mov  eax,-1                 ; close this program
  117.     int  0x40
  118.   noclose:
  119.     cmp  ah,2
  120.     jne  nofile
  121.   kfile:
  122.         test    byte [status], 1
  123.         jnz     still
  124.         or      byte [status], 1
  125.     mov  eax,51
  126.     mov  ebx,1
  127.     mov  ecx,thread1
  128.     mov  edx,0x29fff0
  129.     int  0x40
  130.     jmp  still
  131.   nofile:
  132.     cmp  ah,3
  133.     jne  noopen
  134.  
  135.  kopen:
  136.     mov ecx,-1
  137.     call getappinfo
  138.     mov ebx,dword [I_END+42]
  139.     mov ecx,dword [I_END+46]
  140.     add ebx,10*65536-15
  141.     add ecx,50*65536-55
  142.     mov edx,0xffffff
  143.     mov eax,13
  144.     int 0x40
  145.  
  146.     call load_image
  147.  
  148.   open1:
  149.     cmp word [I_END],word 'BM'
  150.     jne  still
  151.     call convert
  152.     call drawimage
  153.     jmp  still
  154.   noopen:
  155.  
  156.     cmp  ah,4
  157.     jne  noinfo
  158.   kinfo:
  159.         test    byte [status], 2
  160.         jnz     still
  161.         or      byte [status], 2
  162.     mov  eax,51
  163.     mov  ebx,1
  164.     mov  ecx,thread2
  165.     mov  edx,0x2afff0
  166.     int  0x40
  167.     jmp  still
  168.   noinfo:
  169.  
  170. ; “‘’€Ž‚ˆ’œ ”Ž
  171.     cmp  ah,5
  172.     jne  still
  173.   kbgrd:
  174.         test    byte [status], 8
  175.         jnz     still
  176.         or      byte [status], 8
  177.     mov  eax,51
  178.     mov  ebx,1
  179.     mov  ecx,thread3
  180.     mov  edx,0x2bfff0
  181.     int  0x40
  182.     jmp  still
  183.     ;call background
  184.  
  185.  getappinfo:
  186.     mov  eax,9
  187.     mov  ebx,process_info
  188.     int  0x40
  189.     ret
  190.  
  191.  
  192. load_image:
  193.         mov     eax, 70
  194.         mov     ebx, fileinfo
  195.         int     0x40
  196.     mov  eax,[I_END+18]
  197.     mov  ebx,[I_END+22]
  198.         test    ebx, ebx
  199.         jns     @f
  200.         neg     ebx
  201. @@:
  202.     add  eax,20
  203.     cmp  eax,210
  204.     jae  @f
  205.     mov  eax,210
  206. @@:
  207.     add  ebx,58
  208.     cmp  ebx,56
  209.     jae  @f
  210.     mov  ebx,56
  211. @@:
  212.     mov  [wnd_width],eax
  213.     mov  [wnd_height],ebx
  214.     test [bWasDraw],1
  215.     jz   @f
  216.     mov  esi,ebx
  217.     mov  edx,eax
  218.     mov  ecx,-1
  219.     mov  ebx,-1
  220.     mov  eax,67
  221.     int  40h
  222. @@:
  223.     ret
  224.  
  225.  
  226.   drawimage:
  227.     cmp  word [I_END],word 'BM'
  228.     jne  nodrawimage
  229.     mov  eax,7
  230.     mov  ebx,[soi]
  231.         mov     ecx, dword [I_END+18-2]
  232.         mov     cx, [I_END+22]
  233.         test    cx, cx
  234.         jns     @f
  235.         neg     cx
  236. @@:
  237.     mov  edx,10*65536+50
  238.     int  0x40
  239.   nodrawimage:
  240.     ret
  241.  
  242. ; “‘’€Ž‚ˆ’œ ”Ž
  243.   background:
  244.     cmp  word [I_END],word 'BM'
  245.     jne  @f
  246.     mov  eax,15
  247.     mov  ebx,1
  248.     mov  ecx,[I_END+18] ; è¨à¨­ 
  249.     mov  edx,[I_END+22] ; ¢ëá®â 
  250.     int  0x40
  251.  
  252.     mov  esi, ecx
  253.     imul esi, edx
  254.         lea     esi, [esi+esi*2]
  255.     mov  ebx,5
  256.     mov  ecx,[soi]
  257.     xor  edx,edx
  258. ;;;    mov  esi, ;640*480*3
  259.     int  0x40
  260.  
  261.     dec  ebx    ;tile/stretch
  262.     mov  ecx,dword [bgrmode]
  263.     int  0x40
  264.  
  265.     dec  ebx
  266.     int  0x40
  267.    @@:
  268.     ret
  269.  
  270. convert:
  271.         mov     ecx, I_END
  272.         add     ecx, [ecx+2]
  273.         mov     [soi], ecx
  274.         mov     ebp, [I_END+18]
  275.         lea     ebp, [ebp*3]    ; ebp = size of output scanline
  276.         mov     eax, [I_END+22]
  277.         dec     eax
  278.         mul     ebp
  279.         add     eax, ecx
  280.         mov     edi, eax        ; edi points to last scanline
  281.         mov     esi, I_END
  282.         add     esi, [esi+10]
  283.         mov     ebx, I_END+54
  284.         mov     edx, [I_END+22]
  285.         lea     eax, [ebp*2]
  286.         mov     [delta], eax
  287.         test    edx, edx
  288.         jz      .ret
  289.         jns     @f
  290.         neg     edx
  291.         and     [delta], 0
  292.         mov     edi, ecx
  293. @@:
  294.         movzx   eax, word [I_END+28]
  295.         cmp     eax, 24
  296.         jz      convert24
  297.         cmp     eax, 8
  298.         jz      convert8
  299.         cmp     eax, 4
  300.         jz      convert4
  301.         dec     eax
  302.         jz      convert1
  303. .ret:
  304.         ret
  305. convert24:
  306.         mov     ecx, ebp
  307.         rep     movsb
  308.         sub     edi, [delta]
  309.         mov     eax, ebp
  310.         neg     eax
  311.         and     eax, 3
  312.         add     esi, eax
  313.         dec     edx
  314.         jnz     convert24
  315.         ret
  316. convert8:
  317.         push    edi
  318.         add     [esp], ebp
  319. .loopi:
  320.         xor     eax, eax
  321.         lodsb
  322.         cmp     dword [I_END+30], 1
  323.         jnz     .nocompressed
  324. .compressed:
  325.         mov     ecx, eax
  326.         jecxz   .special
  327.         lodsb
  328.         mov     eax, [ebx+eax*4]
  329. @@:
  330.         call    putpixel
  331.         loop    @b
  332.         jmp     .loopi
  333. .nocompressed:
  334.         mov     eax, [ebx+eax*4]
  335.         call    putpixel
  336. .loopicont:
  337.         cmp     edi, [esp]
  338.         jnz     .loopi
  339. .next:
  340.         pop     edi
  341.         sub     edi, [delta]
  342.         mov     eax, ebp
  343.         and     eax, 3
  344.         add     esi, eax
  345.         dec     edx
  346.         jnz     convert8
  347.         ret
  348. .special:
  349.         lodsb
  350.         test    al, al
  351.         jz      .next
  352.         cmp     al, 2
  353.         jbe     .end
  354.         mov     ecx, eax
  355.         push    ecx
  356. @@:
  357.         xor     eax, eax
  358.         lodsb
  359.         mov     eax, [ebx+eax*4]
  360.         call    putpixel
  361.         loop    @b
  362.         pop     ecx
  363.         and     ecx, 1
  364.         add     esi, ecx
  365.         jmp     .loopi
  366. .end:
  367.         pop     edi
  368.         ret
  369. convert4:
  370.         push    edi
  371.         add     [esp], ebp
  372. .loopi:
  373.         xor     eax, eax
  374.         lodsb
  375.         shr     eax, 4
  376.         mov     eax, [ebx+eax*4]
  377.         call    putpixel
  378.         cmp     edi, [esp]
  379.         jz      .loopidone
  380.         mov     al, [esi-1]
  381.         and     eax, 0xF
  382.         mov     eax, [ebx+eax*4]
  383.         stosd
  384.         dec     edi
  385.         cmp     edi, [esp]
  386.         jnz     .loopi
  387. .loopidone:
  388.         pop     edi
  389.         sub     edi, [delta]
  390.         call    align_input
  391.         dec     edx
  392.         jnz     convert4
  393.         ret
  394. convert1:
  395.         push    edi
  396.         add     [esp], ebp
  397. .loopi:
  398.         lodsb
  399.         mov     ecx, 8
  400. .loopii:
  401.         add     al, al
  402.         push    eax
  403.         setc    al
  404.         movzx   eax, al
  405.         mov     eax, [ebx+eax*4]
  406.         call    putpixel
  407.         pop     eax
  408.         cmp     edi, [esp]
  409.         loopnz  .loopii
  410.         jnz     .loopi
  411.         pop     edi
  412.         sub     edi, [delta]
  413.         call    align_input
  414.         dec     edx
  415.         jnz     convert1
  416.         ret
  417.  
  418. align_input:
  419.         push    esi
  420.         sub     esi, I_END
  421.         sub     esi, [I_END+10]
  422.         neg     esi
  423.         and     esi, 3
  424.         add     [esp], esi
  425.         pop     esi
  426.         ret
  427.  
  428. putpixel:
  429.         push    eax
  430.         stosw
  431.         shr     eax, 16
  432.         stosb
  433.         pop     eax
  434.         ret
  435.  
  436. ;   *********************************************
  437. ;   *******  WINDOW DEFINITIONS AND DRAW ********
  438. ;   *********************************************
  439.  
  440.  
  441. draw_window:
  442.     or   [bWasDraw],1
  443.  
  444.     mov  eax,12                    ; function 12:tell os about windowdraw
  445.     mov  ebx,1                     ; 1, start of draw
  446.     int  0x40
  447.  
  448.                                    ; DRAW WINDOW
  449.     xor  eax,eax                   ; function 0 : define and draw window
  450. ;    mov  ebx,350                   ; [x start] *65536 + [x size]
  451. ;    mov  ecx,400                   ; [y start] *65536 + [y size]
  452.     mov  ebx,100*65536
  453.     mov  ecx,100*65536
  454.     add  ebx,[wnd_width]
  455.     add  ecx,[wnd_height]
  456.     mov  edx,0x03ffffff            ; color of work area RRGGBB,8->color gl
  457.     int  0x40
  458.  
  459.     mov  eax,8
  460.     mov  ebx,10*65536+46
  461.     mov  ecx,25*65536+20
  462.     mov  edx,2
  463.     mov  esi,0x780078
  464.   newbutton:
  465.     int  0x40
  466.     add  ebx,48*65536
  467.     inc  edx
  468.     cmp  edx,6
  469.     jb   newbutton
  470.  
  471.                                    ; WINDOW LABEL
  472.     mov  eax,4                     ; function 4 : write text to window
  473.     mov  ebx,8*65536+8             ; [x start] *65536 + [y start]
  474.     mov  ecx,0x10ddeeff            ; font 1 & color ( 0xF0RRGGBB )
  475.     mov  edx,labelt                ; pointer to text beginning
  476.     mov  esi,12                    ; text length
  477.     int  0x40
  478.  
  479.     mov  ebx,14*65536+32
  480.     mov  edx,buttext
  481.     mov  esi,26
  482.     int  0x40
  483.  
  484.     call drawimage
  485.  
  486.     mov  eax,12                    ; function 12:tell os about windowdraw
  487.     mov  ebx,2                     ; 2, end of draw
  488.     int  0x40
  489.  
  490.     ret
  491.  
  492.  
  493. ; DATA AREA
  494.  
  495. labelt:
  496.          db 'MeView v.0.4'
  497.  
  498. lsz buttext,\
  499.     en,   ' FILE   OPEN   INFO   BGRD',\
  500.     ru,   ' ”€‰‹  Ž’Š   ˆ”Ž   ”Ž  ',\
  501.     de,   'DATEI OEFNEN  INFO   HGRD'
  502.  
  503. thread1:                        ; start of thread1
  504.  
  505.      call draw_window1
  506.  
  507. still1:
  508.  
  509.     mov  eax,10                 ; wait here for event
  510.     int  0x40
  511.  
  512.     cmp  eax,1                  ; redraw request ?
  513.     je   thread1
  514.     cmp  eax,2                  ; key in buffer ?
  515.     je   key1
  516.     cmp  eax,3                  ; button in buffer ?
  517.     je   button1
  518.  
  519.     jmp  still1
  520.  
  521.   key1:                         ; key
  522.     int  0x40
  523.     cmp  ah,179
  524.     jne  noright
  525.     mov  eax,[pos]
  526.     cmp  eax,41
  527.     ja   still1
  528.     inc  eax
  529.     mov  [pos],eax
  530.     call drawstring
  531.     jmp  still1
  532.   noright:
  533.     cmp  ah,176
  534.     jne  noleft
  535.     mov  eax,[pos]
  536.     test eax,eax
  537.     je   still1
  538.     dec  eax
  539.     mov  [pos],eax
  540.     call drawstring
  541.     jmp  still1
  542.   noleft:
  543.     cmp  ah,182        ;del
  544.     jne  nodelet
  545.     call shiftback
  546.     call drawstring
  547.     jmp  still1
  548.   nodelet:
  549.     cmp  ah,8          ;zaboy
  550.     jne  noback
  551.     mov  eax,[pos]
  552.     test eax,eax
  553.     je   still1
  554.     dec  eax
  555.     mov  [pos],eax
  556.     call shiftback
  557.     call drawstring
  558.     jmp  still1
  559.   noback:
  560.     cmp  ah,13
  561.     jne  noenter
  562.   enter1:
  563.     mov  al,byte ' '
  564.     mov  edi,string
  565.     mov  ecx,43
  566.     cld
  567.     repne scasb
  568.     dec  edi
  569.     mov  byte [edi],0
  570.     jmp  close1
  571.   noenter:
  572.     cmp  ah,27
  573.     jne  noesc
  574.     jmp  enter1
  575.   noesc:
  576.     cmp  dword [pos],42
  577.     jae  still1
  578.  
  579.     mov  edi,string
  580.     add  edi,42
  581.     mov  esi,edi
  582.     dec  esi
  583.     mov  ecx,42
  584.     sub  ecx,[pos]
  585.     std
  586.     rep  movsb
  587.  
  588.     shr  eax,8
  589.     mov  esi,string
  590.     add  esi,[pos]
  591.     mov  byte [esi],al
  592.     inc  dword [pos]
  593.     call drawstring
  594.  
  595.     jmp  still1
  596.  
  597.   button1:                      ; button
  598.     mov  eax,17                 ; get id
  599.     int  0x40
  600.  
  601.     cmp  ah,1                   ; button id=1 ?
  602.     jne  noclose1
  603.     jmp  enter1
  604.   close1:
  605.     bts  dword [status],2
  606.     btr  dword [status],0
  607.     mov  eax,-1                 ; close this program
  608.     int  0x40
  609.   noclose1:
  610.     cmp  ah,2
  611.     jne  nosetcur
  612.     mov  eax,37
  613.     mov  ebx,1
  614.     int  0x40
  615.     shr  eax,16
  616.     sub  eax,21
  617.     xor  edx,edx
  618.     mov  ebx,6
  619.     div  ebx
  620.     mov  [pos],eax
  621.     call drawstring
  622.     jmp  still1
  623.   nosetcur:
  624.     jmp  still1
  625.  
  626.  
  627.   shiftback:
  628.     mov  edi,string
  629.     add  edi,[pos]
  630.     mov  esi,edi
  631.     inc  esi
  632.     mov  ecx,43
  633.     sub  ecx,[pos]
  634.     cld
  635.     rep movsb
  636.     ret
  637.  
  638. ;   *********************************************
  639. ;   *******  WINDOW DEFINITIONS AND DRAW ********
  640. ;   *********************************************
  641.  
  642.  
  643. draw_window1:
  644.  
  645.  
  646.     mov  eax,12                    ; function 12:tell os about windowdraw
  647.     mov  ebx,1                     ; 1, start of draw
  648.     int  0x40
  649.  
  650.                                    ; DRAW WINDOW
  651.     xor  eax,eax                   ; function 0 : define and draw window
  652.     mov  ebx,100*65536+300         ; [x start] *65536 + [x size]
  653.     mov  ecx,100*65536+80          ; [y start] *65536 + [y size]
  654.     mov  edx,0x03780078            ; color of work area RRGGBB,8->color gl
  655.     int  0x40
  656.  
  657.                                    ; WINDOW LABEL
  658.     mov  eax,4                     ; function 4 : write text to window
  659.     mov  ebx,8*65536+8             ; [x start] *65536 + [y start]
  660.     mov  ecx,0x10ddeeff            ; font 1 & color ( 0xF0RRGGBB )
  661.     mov  edx,labelt1               ; pointer to text beginning
  662.     mov  esi,labelt1.size          ; text length
  663.     int  0x40
  664.  
  665.     call drawstring
  666.  
  667.     mov  eax,12                    ; function 12:tell os about windowdraw
  668.     mov  ebx,2                     ; 2, end of draw
  669.     int  0x40
  670.  
  671.     ret
  672.  
  673.  drawstring:
  674.     pusha
  675.     mov  eax,8             ;invisible button
  676.     mov  ebx,21*65536+258
  677.     mov  ecx,40*65536+15
  678.     mov  edx,0x60000002
  679.     int  0x40
  680.  
  681.     mov  eax,13             ;bar
  682.     mov  edx,0xe0e0e0
  683.     int  0x40
  684.     push eax                ;cursor
  685.     mov  eax,6*65536
  686.     mul  dword [pos]
  687.     add  eax,21*65536+6
  688.     mov  ebx,eax
  689.     pop  eax
  690.     mov  edx,0x6a73d0
  691.     int  0x40
  692.     mov  eax,4              ;path
  693.     mov  ebx,21*65536+44
  694.     xor  ecx,ecx
  695.     mov  edx,string
  696.     mov  esi,43
  697.     int  0x40
  698.  
  699.  
  700.     popa
  701.     ret
  702.  
  703. ; DATA AREA
  704.  
  705. lsz labelt1,\
  706.    en,  'File',\
  707.    ru,  '” ©«',\
  708.    de,  'Datei'
  709.  
  710. thread2:                          ; start of info thread
  711.  
  712.      call draw_window2
  713.  
  714. still2:
  715.  
  716.     mov  eax,10                 ; wait here for event
  717.     int  0x40
  718.  
  719.     cmp  eax,1                  ; redraw request ?
  720.     je   thread2
  721.     cmp  eax,2                  ; key in buffer ?
  722.     je   close2
  723.     cmp  eax,3                  ; button in buffer ?
  724.     je   button2
  725.  
  726.     jmp  still2
  727.  
  728.   button2:                       ; button
  729.     mov  eax,17                 ; get id
  730.     int  0x40
  731.  
  732.     cmp  ah,1                   ; button id=1 ?
  733.     jne  noclose2
  734.   close2:
  735.     btr dword [status],1
  736.     bts dword [status],2
  737.     mov  eax,-1                 ; close this program
  738.     int  0x40
  739.   noclose2:
  740.  
  741.     jmp  still2
  742.  
  743.  
  744.  
  745.  
  746. ;   *********************************************
  747. ;   *******  WINDOW DEFINITIONS AND DRAW ********
  748. ;   *********************************************
  749.  
  750.  
  751. draw_window2:
  752.  
  753.  
  754.     mov  eax,12                    ; function 12:tell os about windowdraw
  755.     mov  ebx,1                     ; 1, start of draw
  756.     int  0x40
  757.  
  758.                                    ; DRAW WINDOW
  759.     xor  eax,eax                   ; function 0 : define and draw window
  760.     mov  ebx,100*65536+330         ; [x start] *65536 + [x size]
  761.     mov  ecx,100*65536+90          ; [y start] *65536 + [y size]
  762.     mov  edx,0x03780078            ; color of work area RRGGBB,8->color gl
  763.     int  0x40
  764.  
  765.                                    ; WINDOW LABEL
  766.     mov  eax,4                     ; function 4 : write text to window
  767.     mov  ebx,8*65536+8             ; [x start] *65536 + [y start]
  768.     mov  ecx,0x10ddeeff            ; font 1 & color ( 0xF0RRGGBB )
  769.     mov  edx,labelt2               ; pointer to text beginning
  770.     mov  esi,labelt2.size          ; text length
  771.     int  0x40
  772.  
  773.     mov  ebx,10*65536+30
  774.     mov  edx,string
  775.     mov  esi,43
  776.     int  0x40
  777.     mov  edx,fitext
  778.     mov  esi,14
  779.     add  ebx,70*65536+10
  780.  followstring:
  781.     int  0x40
  782.     add  ebx,10
  783.     add  edx,esi
  784.     cmp  ebx,80*65536+70
  785.     jbe  followstring
  786.     mov  eax,47
  787.     mov  edx,200*65536+40
  788.     mov  esi,ecx
  789.     mov  ecx, [I_END+2]
  790.     call digitcorrect
  791.     int  0x40
  792.     add  edx,10
  793.     mov  ecx, [I_END+18]
  794.     call digitcorrect
  795.     int  0x40
  796.     add  edx,10
  797.     mov  ecx, [I_END+22]
  798.     call digitcorrect
  799.     int  0x40
  800.     add  edx,10
  801.     movzx ecx,word [I_END+28]
  802.     call digitcorrect
  803.     int  0x40
  804.  
  805.     mov  eax,12                    ; function 12:tell os about windowdraw
  806.     mov  ebx,2                     ; 2, end of draw
  807.     int  0x40
  808.  
  809.     ret
  810.  
  811.  digitcorrect:
  812.     xor  ebx,ebx
  813.     mov  bh,6
  814.     cmp  ecx,99999
  815.     ja   c_end
  816.     dec  bh
  817.     cmp  ecx,9999
  818.     ja   c_end
  819.     dec  bh
  820.     cmp  ecx,999
  821.     ja   c_end
  822.     dec  bh
  823.     cmp  ecx,99
  824.     ja   c_end
  825.     dec  bh
  826.     cmp  ecx,9
  827.     ja   c_end
  828.     dec  bh
  829.  c_end:
  830.     bswap ebx
  831.     ret
  832.  
  833.  
  834. ; DATA AREA
  835.  
  836. lsz labelt2,\
  837.     en,   'File info',\
  838.     ru,   'ˆ­ä®à¬ æ¨ï ® ä ©«¥',\
  839.     de,   'Dateiinfo'
  840.  
  841. lsz fitext,\
  842.      en, 'FILE SIZE     ',\
  843.      en, 'X SIZE        ',\
  844.      en, 'Y SIZE        ',\
  845.      en, 'BITS PER PIXEL',\
  846.                           \
  847.      ru, ' §¬¥à ä ©«   ',\
  848.      ru, '˜¨à¨­         ',\
  849.      ru, '‚ëá®â         ',\
  850.      ru, '¨â ­  ¯¨ªá¥« ',\
  851.                           \
  852.      de, 'FATEIGROESSE  ',\
  853.      de, 'X GROESSE     ',\
  854.      de, 'Y GROESSE     ',\
  855.      de, 'BITS PER PIXEL'
  856.  
  857. thread3:                          ; start of bgrd thread
  858.  
  859.      call draw_window3
  860.  
  861. still3:
  862.  
  863.     mov  eax,10                 ; wait here for event
  864.     int  0x40
  865.  
  866.     cmp  eax,1                  ; redraw request ?
  867.     je   thread3
  868.     cmp  eax,2                  ; key in buffer ?
  869.     je   key3
  870.     cmp  eax,3                  ; button in buffer ?
  871.     je   button3
  872.  
  873.     jmp  still3
  874.  
  875.   key3:
  876.     int  0x40
  877.     cmp  ah,27
  878.     je   close3
  879.     cmp  ah,13
  880.     je   kok
  881.     cmp  ah,178 ;up
  882.     jne  nofup
  883.     cmp  dword [bgrmode],1
  884.     je   fdn
  885.   fup:
  886.     dec dword [bgrmode]
  887.     jmp  flagcont
  888.   nofup:
  889.     cmp  ah,177 ;down
  890.     jne  still3
  891.     cmp dword [bgrmode],2
  892.     je   fup
  893.   fdn:
  894.     inc dword [bgrmode]
  895.     jmp  flagcont
  896.  
  897.  
  898.   button3:                       ; button
  899.     mov  eax,17                 ; get id
  900.     int  0x40
  901.  
  902.     cmp  ah,1                   ; button id=1 ?
  903.     jne  noclose3
  904.   close3:
  905.     btr dword [status],3
  906.     bts dword [status],2
  907.     mov  eax,-1                 ; close this program
  908.     int  0x40
  909.   noclose3:
  910.     cmp  ah,4
  911.     jne  nook
  912.    kok:
  913.     call background
  914.     jmp  close3
  915.   nook:
  916.     cmp  ah,2
  917.     jb   still3
  918.     cmp  ah,3
  919.     ja   still3
  920.     dec  ah
  921.     mov byte [bgrmode],ah
  922.    flagcont:
  923.     call drawflags
  924.     jmp  still3
  925.  
  926.  
  927.  
  928.  
  929. ;   *********************************************
  930. ;   *******  WINDOW DEFINITIONS AND DRAW ********
  931. ;   *********************************************
  932.  
  933.  
  934. draw_window3:
  935.  
  936.  
  937.     mov  eax,12                    ; function 12:tell os about windowdraw
  938.     mov  ebx,1                     ; 1, start of draw
  939.     int  0x40
  940.  
  941.                                    ; DRAW WINDOW
  942.     xor  eax,eax                   ; function 0 : define and draw window
  943.     mov  ebx,100*65536+200         ; [x start] *65536 + [x size]
  944.     mov  ecx,100*65536+100         ; [y start] *65536 + [y size]
  945.     mov  edx,0x03780078            ; color of work area RRGGBB,8->color gl
  946.     int  0x40
  947.  
  948.     mov  eax,8
  949.     mov  ebx,70*65536+40
  950.     mov  ecx,70*65536+20
  951.     mov  edx,4
  952.     mov  esi,0xac0000
  953.     int  0x40
  954.  
  955.                                    ; WINDOW LABEL
  956.     mov  eax,4                     ; function 4 : write text to window
  957.     mov  ebx,8*65536+8             ; [x start] *65536 + [y start]
  958.     mov  ecx,0x10ddeeff            ; font 1 & color ( 0xF0RRGGBB )
  959.     mov  edx,labelt3               ; pointer to text beginning
  960.     mov  esi,labelt3.size          ; text length
  961.     int  0x40
  962.     add  ebx,38*65536+20
  963.     mov  ecx,0xddeeff
  964.     mov  edx, bgrdtext
  965.     mov  esi, bgrdtext.size
  966.     int  0x40
  967.     add  ebx,40*65536+15
  968.     mov  edx, tiled
  969.     mov  esi, tiled.size
  970.     int  0x40
  971.     add  ebx,15
  972.     mov  edx, stretch
  973.     mov  esi, stretch.size ;7
  974.     int  0x40
  975.     add  ebx,18
  976.     mov  edx, ok_btn
  977.     mov  esi, ok_btn.size ;2
  978.     int  0x40
  979.  
  980.     call drawflags
  981.  
  982.     mov  eax,12                    ; function 12:tell os about windowdraw
  983.     mov  ebx,2                     ; 2, end of draw
  984.     int  0x40
  985.  
  986.     ret
  987.  
  988.  drawflags:
  989.     mov  eax,8
  990.     mov  ebx,70*65536+10
  991.     mov  ecx,40*65536+10
  992.     mov  edx,2
  993.     mov  esi,0xe0e0e0
  994.     int  0x40
  995.     add  ecx,15*65536
  996.     inc  edx
  997.     int  0x40
  998.     mov  eax,4
  999.     mov  ebx,73*65536+42
  1000.     xor  ecx,ecx
  1001.     mov  edx,vflag
  1002.     mov  esi,1
  1003.     cmp  dword [bgrmode],1
  1004.     je   nodownflag
  1005.     add  ebx,15
  1006.  nodownflag:
  1007.     int  0x40
  1008.     ret
  1009.  
  1010.  
  1011. ; DATA AREA
  1012. status   dd 0  ;bit0=1 if file thread is created
  1013. soi      dd 0
  1014. delta   dd      0
  1015. process  dd 0
  1016.  
  1017. bWasDraw db 0
  1018. vflag: db 'x'
  1019. bgrmode: dd 1
  1020.  
  1021. wnd_width dd 210
  1022. wnd_height dd 53
  1023.  
  1024. lsz labelt3,\
  1025.     en,   'Background set',\
  1026.     ru,   "“áâ ­®¢ª  ä®­ ",\
  1027.     de,   'Hintergrund gesetzt'
  1028.  
  1029. lsz bgrdtext,\
  1030.     en, 'SET AS BACKGROUND:',\
  1031.     ru, '’¨¯ ®¡®¥¢:',\
  1032.     de, 'ALS HINTERGRUND'
  1033.  
  1034. lsz tiled,\
  1035.     en, 'TILED',\
  1036.     ru, '§ ¬®áâ¨âì',\
  1037.     de, 'GEKACHELT'
  1038.  
  1039. lsz stretch,\
  1040.     en, 'STRETCH',\
  1041.     ru, 'à áâï­ãâì',\
  1042.     de, 'GESTRECKT'
  1043.  
  1044. lsz ok_btn,\
  1045.     en, 'Ok',\
  1046.     ru, 'Ok',\
  1047.     de, 'Ok'
  1048.  
  1049. pos: dd 6
  1050. fileinfo:
  1051.      dd 0
  1052.      dd 0
  1053.      dd 0
  1054.      dd 0x290000-I_END
  1055.      dd I_END
  1056. string:
  1057.         db      '/rd/1/bgr.bmp',0
  1058.  
  1059. IM_END:
  1060.         rb      string+257-$
  1061.  
  1062. process_info:
  1063. temp_area:
  1064. rb 0x10000
  1065. I_END:
  1066.