Subversion Repositories Kolibri OS

Rev

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