Subversion Repositories Kolibri OS

Rev

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

  1. ; Yahoo Messanger for MenuetOS
  2. ; Compile with FASM for Menuet
  3.    
  4. ;B+ System header
  5. use32
  6. org 0x0
  7.  db  'MENUET01'
  8.  dd  0x01
  9.  dd  START
  10.  dd  I_END
  11.  dd  0x100000
  12.  dd  0x7fff0
  13.  dd  0x0,0x0
  14. ;E:.
  15. include 'lang.inc'  
  16. ;B+ Definitions
  17. v_sp equ 330
  18. h_sp equ 400
  19. fr_sp equ 120
  20.    
  21. line_wid equ 45
  22. fr_max_lines equ 17                                                            
  23.    
  24. ;memory
  25. sys_colors  equ I_END
  26. text_zone   equ sys_colors+4*10
  27. ;friend_zone equ text_zone+45*25                        ;uncom
  28.             ;friend_zone+32*fr_max_lines
  29. ;E:.
  30.    
  31. START:
  32. ;B+ Main execution
  33.    
  34.   call clear_text
  35.    
  36. red:
  37.   call draw_window
  38. still:
  39.   mov  ebx,50
  40.   mov  eax,23
  41.   int  0x40
  42.    
  43.   cmp  eax,1
  44.   je   red
  45.   cmp  eax,2
  46.   je   key
  47.   cmp  eax,3
  48.   je   button
  49.    
  50.   call check_message
  51.    
  52.   jmp  still
  53.    
  54. key:
  55.   mov  eax,2
  56.   int  0x40
  57.   cmp  [is_connect],0
  58.   je   still
  59.   call send_key_string
  60.   jmp  still
  61.    
  62. button:
  63.   mov  eax,17
  64.   int  0x40
  65.    
  66.   cmp  ah,1
  67.   jne  noclose
  68.   mov  eax,-1
  69.   int  0x40
  70.   jmp  $
  71. noclose:
  72.    
  73. ;B+ Check friend
  74.   cmp  ah,2
  75.   jb   .no_friend
  76.   cmp  ah,100
  77.   ja   .no_friend
  78.    
  79.   ;pressed number
  80.   sub  ah,2
  81.   shr  ax,8
  82.    
  83.   ;find real name
  84.   mov  [friend_p],friend_zone
  85.   mov  edi,0
  86. .next:
  87.  push [friend_p]
  88.   call test_friend
  89.   jc   .group
  90.   inc  edi
  91. .group:
  92.   cmp  di,ax
  93.  pop  ebx
  94.   jbe  .next
  95.   inc  ebx
  96.   ;exact place
  97.   mov  ecx,[friend_p]
  98.   sub  ecx,ebx
  99.   dec  ecx
  100.    
  101.   ;Insert in send
  102.   cmp  al,10
  103.   jb   .good
  104.   add  al,'A'-'0'-10
  105. .good:
  106.   add  al,'0'
  107.   mov  [view_text+1],al
  108.    
  109.   ;Clear old a. friend
  110.  pusha
  111.   mov  ebx,(h_sp-140) shl 16 + 132
  112.   mov  ecx,(v_sp-53) shl 16 + 10
  113.   mov  edx,[sys_colors+4*5]
  114.   mov  eax,13
  115.   int  0x40
  116.  popa
  117.    
  118.   ;show item
  119.   mov  [f_name_b],ebx
  120.   mov  [f_name_l],ecx
  121.   call show_a_friend
  122.   jmp  still
  123.    
  124. .no_friend:
  125. ;E:.
  126.    
  127. ;B+ Check User / Password
  128.   cmp  ah,103
  129.   je   input_username
  130.   cmp  ah,104
  131.   je   input_password
  132. ;E:.
  133.    
  134. ;B+ Connect / Dis...
  135.   cmp  ah,101
  136.   je   yahoo_c
  137.   cmp  ah,102
  138.   je   yahoo_d
  139. ;E:.
  140.    
  141.   jmp  still
  142. ;E:.
  143.    
  144. draw_window:
  145. ;B+ Draw window
  146.   mov  ebx,1
  147.   mov  eax,12
  148.   int  0x40
  149.    
  150.   mov  ebx,3
  151.   mov  ecx,sys_colors
  152.   mov  edx,10*4
  153.   mov  eax,48
  154.   int  0x40
  155.    
  156.   mov  ebx,150*65536+h_sp
  157.   mov  ecx,100*65536+v_sp
  158.   mov  edx,[sys_colors+4*5]
  159.   or   edx,0x02000000
  160.   mov  esi,[sys_colors+4*1]
  161.   or   esi,0x80000000
  162.   mov  edi,[sys_colors+4*0]
  163.   mov  eax,0
  164.   int  0x40
  165.    
  166.   mov  ebx,8*65536+8
  167.   mov  ecx,[sys_colors+4*4]
  168.   or   ecx,0x10000000
  169.   mov  edx,caption
  170.   mov  esi,caption_end-caption
  171.   mov  eax,4
  172.   int  0x40
  173.    
  174.   mov  ebx,(400-19) shl 16 + 12
  175.   mov  ecx,5 shl 16 + 12
  176.   mov  edx,1
  177.   mov  esi,[sys_colors+4*2]
  178.   mov  eax,8
  179.   int  0x40
  180.    
  181. ;B+ Friend panel
  182.   mov  ebx,(h_sp-fr_sp) shl 16 + 3
  183.   mov  ecx,20 shl 16 + v_sp-31 -56
  184.   mov  edx,[sys_colors+4*9]
  185.   mov  eax,13
  186.   int  0x40
  187.   call show_friends
  188. ;E:.
  189.    
  190. ;B+ Input panel
  191.   mov  ebx,5 shl 16 + h_sp-9
  192.   mov  ecx,(v_sp-31 -33-3) shl 16 + 3
  193.   mov  edx,[sys_colors+4*9]
  194.   mov  eax,13
  195.   int  0x40
  196.   mov  ebx,(h_sp-(fr_sp-12)*8/6) shl 16 + 4
  197.   mov  ecx,(v_sp-31-33) shl 16 + 30
  198.   int  0x40
  199.   mov  ebx,(h_sp-8) shl 16 + 4
  200.   int  0x40
  201.   call show_a_friend
  202.   call show_string
  203. ;E:.
  204.    
  205. ;B+ Login panel
  206.   mov  ebx,5 shl 16 + h_sp-9
  207.   mov  ecx,(v_sp-35) shl 16 + 31
  208.   mov  edx,[sys_colors+4*9]
  209.   mov  eax,13
  210.   int  0x40
  211.   mov  ebx,(5+2+8+(user_txt_end-user_txt)*6) shl 16 + 6*15+7
  212.   mov  ecx,(v_sp-32) shl 16 + 12
  213.   mov  edx,[sys_colors+4*5]
  214.   int  0x40
  215.   mov  ebx,(171+2+8+(psw_txt_end-psw_txt)*6) shl 16 + 6*23+7
  216.   mov  ecx,(v_sp-32) shl 16 + 12
  217.   int  0x40
  218.    
  219.   ;connect button
  220.   mov  ebx,(h_sp-128) shl 16 + (con_txt_end-con_txt)*6 + 7
  221.   mov  ecx,(v_sp-18) shl 16 + 12
  222.   mov  edx,101
  223.   mov  esi,[sys_colors+4*6]
  224.   mov  eax,8
  225.   int  0x40
  226.   ;disconnect button
  227.   shl  ebx,16
  228.   add  ebx,(h_sp-128+3) shl 16 + (dis_txt_end-dis_txt)*6 + 7
  229.   mov  edx,102
  230.   int  0x40
  231.   ;user button
  232.   mov  ebx,8 shl 16 + (user_txt_end-user_txt)*6 + 5
  233.   mov  ecx,(v_sp-18-15) shl 16 + 12
  234.   mov  edx,103
  235.   int  0x40
  236.   ;password button
  237.   mov  ebx,174 shl 16 + (psw_txt_end-psw_txt)*6 + 5
  238.   mov  edx,104
  239.   int  0x40
  240.    
  241.   ;login text
  242.   mov  ebx,11 shl 16 + v_sp-15
  243.   mov  ecx,[sys_colors+4*7]
  244.   mov  edx,login_txt
  245.   mov  esi,login_txt_end-login_txt
  246.   mov  eax,4
  247.   int  0x40
  248.   ;user text
  249.   mov  ebx,11 shl 16 + v_sp-15-15
  250.   mov  edx,user_txt
  251.   mov  esi,user_txt_end-user_txt
  252.   int  0x40
  253.   ;password text
  254.   mov  ebx,(174+5) shl 16 + v_sp-15-15
  255.   mov  edx,psw_txt
  256.   mov  esi,psw_txt_end-psw_txt
  257.   int  0x40
  258.   ;connect text
  259.   mov  ebx,(h_sp-128+5) shl 16 + v_sp-15
  260.   mov  edx,con_txt
  261.   mov  esi,con_txt_end-con_txt
  262.   int  0x40
  263.   ;disconnect text
  264.   add  ebx,((con_txt_end-con_txt)*6+8 + 3) shl 16
  265.   mov  edx,dis_txt
  266.   mov  esi,dis_txt_end-dis_txt
  267.   int  0x40
  268.    
  269.   call show_username
  270.   call show_password
  271. ;E:.
  272.    
  273.   call show_text
  274.    
  275.   mov  ebx,2
  276.   mov  eax,12
  277.   int  0x40
  278.   ret
  279. ;E:.
  280.    
  281. show_friends:
  282. ;B+ Show friend list
  283.   cmp  [last_friend_place],friend_zone
  284.   jne  .yes_show
  285.   ret
  286. .yes_show:
  287.    
  288.   ;show button
  289.   mov  ebx,(h_sp-fr_sp+5) shl 16 + 10
  290.   mov  ecx,(20+3) shl 16 + 10
  291.   mov  edx,2
  292.   mov  esi,[sys_colors+4*6]
  293.   mov  eax,8
  294.   mov  edi,0
  295.    
  296.   mov  [friend_p],friend_zone
  297. .next_button:
  298.   call test_friend
  299.   jc   .no_b
  300.   int  0x40
  301.   inc  edx
  302. .no_b:
  303.   inc  edi
  304.   add  ecx,15 shl 16
  305.   cmp  edi,[last_friend_line]
  306.   jne  .next_button
  307.    
  308.   ;show numbers
  309.   mov  [digit],'0'-1
  310.   mov  ebx,(h_sp-fr_sp+8) shl 16 + (20+3)+2
  311.   ;mov  ecx,[sys_colors+4*7]
  312.   mov  edx,digit
  313.   mov  esi,1
  314.   mov  eax,4
  315.   mov  edi,0
  316.    
  317.   mov  [friend_p],friend_zone
  318.  push edx
  319. .next_digit:
  320.   mov  edx,[friend_p]
  321.   call test_friend
  322.   cmp  [edx],byte 1
  323.   je   .no_item
  324.   inc  [digit]
  325.   cmp  [digit],'9'+1
  326.   jne  .good
  327.   mov  [digit],'A'
  328. .good:
  329.   ;add  ebx,1 shl 16
  330.   cmp  [edx],byte 2
  331.   mov  edx,[esp]
  332.   mov  ecx,[sys_colors+4*6]
  333.   call hi_light
  334.   jne  .no_online
  335.   mov  ecx,[sys_colors+4*7]
  336.   ;int  0x40
  337.   ;or    ecx,0x10000000
  338. .no_online:
  339.   ;sub  ebx,1 shl 16
  340.   int  0x40
  341.   ;and  ecx,not 0x10000000
  342. .no_item:
  343.   add  ebx,15
  344.   inc  edi
  345.   cmp  edi,[last_friend_line]
  346.   jne  .next_digit
  347.   add  esp,4
  348.    
  349.   ;show names
  350.   mov  ebx,(h_sp-fr_sp+8 + 10) shl 16 + (20+3)+2
  351.   mov  ecx,[sys_colors+4*8]
  352.   mov  eax,4
  353.   mov  edi,0
  354.    
  355.   mov  [friend_p],friend_zone
  356.   mov  esi,4
  357. .next_name:
  358.   mov  edx,[friend_p]
  359.   call test_friend
  360.   mov  esi,[friend_p]
  361.   inc  edx
  362.   sub  esi,edx
  363.    
  364.   and  ebx,0xffff
  365.   or   ebx,(h_sp-fr_sp+8 + 10) shl 16
  366.   cmp  [edx-1],byte 1
  367.   jne  .no_group
  368.   sub  ebx,12 shl 16
  369. .no_group:
  370.   int  0x40
  371.   add  ebx,15
  372.   inc  edi
  373.   cmp  edi,[last_friend_line]
  374.   jne  .next_name
  375.    
  376.   ret
  377. .p db 16 ;>
  378.    
  379. digit db '0'
  380. ;last_friend_line dd 0x0                                ;uncom
  381.    
  382. test_friend:
  383.  push eax
  384.   mov  eax,[friend_p]
  385.   clc
  386.   cmp  [eax],byte 1
  387.   jne  .no_hide
  388.   stc
  389. .no_hide:
  390.  pushf
  391. .next:
  392.   inc  [friend_p]
  393.   mov  eax,[friend_p]
  394.   cmp  [eax],byte 0
  395.   jne  .next
  396.   inc  [friend_p]
  397.  popf
  398.  pop  eax
  399.   ret
  400.    
  401. friend_p dd 0x0
  402.    
  403. hi_light:
  404.  pushf
  405.   add  ecx,0x400000
  406.   test ecx,0xb00000
  407.   jnz  .no_red_plus
  408.   sub  ecx,0x400000
  409. .no_red_plus:
  410.   add  ecx,0x004000
  411.   test ecx,0x00b000
  412.   jnz  .no_green_plus
  413.   sub  ecx,0x008000
  414. .no_green_plus:
  415.   add  ecx,0x000040 ;80
  416.   test ecx,0x0000b0 ;80
  417.   jnz  .no_blue_plus
  418.   sub  ecx,0x000040 ;100
  419. .no_blue_plus:
  420.  popf
  421.   ret
  422. ;E:.
  423.    
  424. ;B+ Message text op.
  425. clear_text:
  426.   mov  edi,text_zone
  427.   mov  ecx,45*26
  428.   mov  al,0
  429.   cld
  430. rep stosb
  431.   ret
  432.    
  433. show_text:
  434.   mov  ebx,7 shl 16 + (20+3) ;+ 2
  435.   mov  ecx,[sys_colors+4*8]
  436.   mov  edx,text_zone+45
  437.   mov  esi,45
  438.   mov  eax,4
  439.   mov  edi,0
  440. .next_line:
  441.   cmp  [edx-1],byte 0
  442.   jne  .shift
  443.   int  0x40
  444. .next:
  445.   add  ebx,10
  446.   add  edx,45
  447.   inc  edi
  448.   cmp  edi,24
  449.   jne  .next_line
  450.   ret
  451. .shift:
  452.   add  ebx,3 shl 16
  453.   int  0x40
  454.   sub  ebx,3 shl 16
  455.   jmp  .next
  456.    
  457. scroll_text:
  458.  pusha
  459.   ;move text
  460.   mov  edi,text_zone
  461.   mov  esi,edi
  462.   add  esi,line_wid
  463.   mov  ecx,line_wid*24
  464.   cld
  465. rep movsb
  466.   ;clear last line
  467.   mov  ecx,line_wid
  468.   mov  al,0
  469. rep stosb
  470.   ;clear zone
  471.   mov  ebx,7 shl 16 + line_wid*6+2
  472.   mov  ecx,(25-2) shl 16 + 24*10-2 +2
  473.   mov  edx,[sys_colors+4*5]
  474.   mov  eax,13
  475.   int  0x40
  476.   ;show text
  477.   call show_text
  478.  popa
  479.   ret
  480.    
  481. show_message:
  482.  ;ebx - begin
  483.  ;ecx - length
  484.    
  485.   mov  eax,[.m_p]
  486.   add  eax,ecx
  487. .test:
  488.   cmp  eax,text_zone+line_wid*25-1
  489.   jb   .good1
  490.   call scroll_text
  491.   sub  eax,line_wid
  492.   sub  [.m_p],line_wid
  493.   jmp  .test
  494. .good1:
  495.   cmp  [.m_p],text_zone+line_wid
  496.   jae  .good2
  497.   add  ebx,line_wid
  498.   add  [.m_p],line_wid
  499.   sub  ecx,line_wid
  500.   jmp  .good1
  501. .good2:
  502.   ;
  503.  push ecx
  504.   mov  esi,ebx
  505.   mov  edi,[.m_p]
  506.   cld
  507. rep movsb
  508.  pop  ecx
  509.    
  510.   ;find v place
  511.   mov  eax,[.m_p]
  512.   sub  eax,text_zone+line_wid
  513.   mov  ebx,line_wid
  514.   xor  edx,edx
  515.   div  ebx
  516.   xor  edx,edx
  517.   mov  ebx,10
  518.   mul  ebx
  519.   mov  ebx,eax
  520.   ;show line
  521.   add  ebx,7 shl 16 + 23 ;+2
  522.   mov  ecx,[sys_colors+4*8]
  523.   mov  edx,[.m_p]
  524.   mov  esi,line_wid
  525.   mov  eax,4
  526.   int  0x40
  527.   add  ebx,3 shl 16
  528. .next_line:
  529.   add  ebx,10
  530.   add  edx,line_wid
  531.   cmp  [edx-1],byte 0
  532.   je   .good3
  533.   int  0x40
  534.   jmp  .next_line
  535. .good3:
  536.   mov  [.m_p],edx
  537.   ret
  538.    
  539. .m_p dd text_zone+45
  540. ;E:.
  541.    
  542. ;B+ Show current people
  543. show_a_friend:
  544.   mov  ebx,(h_sp-137) shl 16 + v_sp-52
  545.   mov  ecx,[sys_colors+4*8]
  546.   or   ecx,0x10000000
  547.   mov  edx,[f_name_b]
  548.   mov  esi,[f_name_l]
  549.   mov  eax,4
  550.   int  0x40
  551.   ret
  552.    
  553. f_name_b dd fnb
  554. f_name_l dd 10
  555.    
  556. fnb:
  557.  db 'yahoo_help'
  558. ;E:.
  559.    
  560. ;B+ Input strings
  561. send_key_string:
  562. ;B+ Test active keys
  563.   cmp  ah,13
  564.   je   send_text
  565.   cmp  ah,27
  566.   je   clear_input_text
  567.   cmp  ah,8
  568.   je   .backs_text
  569. ;E:.
  570.    
  571.   mov  [.this_c],ah
  572.   cmp  [.c_pl],123
  573.   jne  .show
  574.   ret
  575. .show:
  576.    
  577.   ;save char
  578.   mov  ebx,[.c_pl]
  579.   mov  [in_text+ebx],ah
  580.   inc  [.c_pl]
  581.    
  582.   ;show char
  583.   mov  ebx,[.xy]
  584.   mov  ecx,[sys_colors+4*8]
  585.   mov  edx,.this_c
  586.   mov  esi,1
  587.   mov  eax,4
  588.   int  0x40
  589.   ;
  590.   cmp  [.c_pl],41
  591.   je   .new_line
  592.   cmp  [.c_pl],82
  593.   je   .new_line
  594.   add  [.xy],6 shl 16
  595.   call show_cursor
  596.   ret
  597.   ;;;
  598. .new_line:
  599.   and  [.xy],0x0000ffff
  600.   add  [.xy],9 shl 16 + 9
  601.   call show_cursor
  602.   ret
  603.    
  604. .this_c db ' '
  605. .c_pl dd 0x0
  606. .xy dd 7 shl 16 + v_sp-62
  607.    
  608. ;B+ Special keys - action
  609. .backs_text:
  610.   ;
  611.   cmp  [.c_pl],0
  612.   jne  .yes_back
  613.   ret
  614. .yes_back:
  615.   cmp  [.c_pl],41
  616.   je   .back_line
  617.   add  [.xy],2 shl 16
  618.   cmp  [.c_pl],82
  619.   je   .back_line
  620.   sub  [.xy],2 shl 16
  621. .next:
  622.   ;
  623.   sub  [.xy],6 shl 16
  624.   dec  [.c_pl]
  625.   mov  eax,[.c_pl]
  626.   mov  bl,[in_text+eax]
  627.   mov  [.this_c],bl
  628.   mov  ebx,[.xy]
  629.   mov  ecx,[sys_colors+4*5]
  630.   mov  edx,.this_c
  631.   mov  esi,1
  632.   mov  eax,4
  633.   int  0x40
  634.   mov  ebx,[.c_pl]
  635.   mov  [in_text+ebx],byte 0
  636.   jmp  show_cursor
  637.   ;
  638. .back_line:
  639.   ;and  [.xy],0x0000ffff
  640.   sub  [.xy],9
  641.   add  [.xy],(253-9) shl 16
  642.   jmp  .next
  643.    
  644. send_text:
  645.   ;show text to message board
  646.   mov  ebx,view_text
  647.   mov  ecx,[send_key_string.c_pl]
  648.   add  ecx,3
  649.   call show_message
  650.    
  651.   ;send message to internet
  652.   ;call internet_send
  653.    
  654. clear_input_text:
  655.   ;prepare new message
  656.   ;; clear memory
  657.   mov  edi,in_text
  658.   mov  ecx,255/4
  659.   xor  eax,eax
  660.   cld
  661. rep stosd
  662.   ;; clear zone
  663.   mov  ebx,5 shl 16 + h_sp-140-9
  664.   mov  ecx,(v_sp-31 -33) shl 16 + 29
  665.   mov  edx,[sys_colors+4*5]
  666.   mov  eax,13
  667.   int  0x40
  668.   ;; move cursor
  669.   mov  ebx,7 shl 16 + v_sp-62
  670.   mov  [send_key_string.xy],ebx
  671.   mov  [show_cursor.old_xy],ebx
  672.   ;; clear place
  673.   xor  ebx,ebx
  674.   mov  [send_key_string.c_pl],ebx
  675.    
  676. ;  call show_cursor
  677. ;  ret
  678. ;E:.
  679.    
  680. show_cursor:
  681.   ;login text
  682. ;  mov  ebx,4 shl 16 + v_sp-64
  683.   mov  ebx,[.old_xy]
  684.   sub  ebx,3 shl 16 + 2
  685.   mov  ecx,[sys_colors+4*5]
  686.   mov  edx,curs
  687.   mov  esi,1
  688.   mov  eax,4
  689.   int  0x40
  690.   add  ebx,4
  691.   int  0x40
  692.   mov  ebx,[send_key_string.xy]
  693.   mov  [.old_xy],ebx
  694.   sub  ebx,3 shl 16 + 2
  695.   mov  ecx,0xffffff;[sys_colors+4*8]
  696.   int  0x40
  697.   add  ebx,4
  698.   int  0x40
  699.   ret
  700.    
  701. .old_xy dd 7 shl 16 + v_sp-62
  702. curs db '|'
  703.    
  704. show_string:
  705.   mov  ebx,7 shl 16 + v_sp-62
  706.   mov  ecx,[sys_colors+4*8]
  707.   mov  edx,in_text
  708.   mov  esi,41
  709.   mov  eax,4
  710.   int  0x40
  711.   add  ebx,2 shl 16 + 9
  712.   add  edx,41
  713.   int  0x40
  714.   add  ebx,9
  715.   add  edx,41
  716.   int  0x40
  717.   call show_cursor
  718.   ret
  719.    
  720. view_text db 16,'?',16
  721. in_text: times 255 db 0
  722. ;E:.
  723.    
  724. ;B+ Friends...
  725. add_friend:
  726.  ;ebx - begin
  727.  ; [ebx]=1 - Group name
  728.  ; [ebx]=2 - Active user
  729.  ; [ebx]=other - Non active user
  730.  ;ecx - length
  731.   cmp  [last_friend_line],fr_max_lines-1
  732.   je   .no_more
  733.   test ecx,not 31
  734.   jnz  .no_more ; very long id name
  735.   inc  [last_friend_line]
  736.   mov  esi,ebx
  737.   mov  edi,[last_friend_place]
  738.   inc  ecx
  739.   add  [last_friend_place],ecx
  740.   dec  ecx
  741.   cld
  742. rep movsb
  743.   mov  al,0
  744.   stosb
  745.   stosb
  746. .no_more:
  747.   ret
  748.    
  749. last_friend_place dd fr_e                               ;del
  750. ;last_friend_place dd friend_zone                       ;uncom
  751.    
  752. find_friend:
  753.  push ebx ecx
  754.   mov  edx,friend_zone
  755.   mov  esi,0
  756.   mov  edi,[last_friend_line]
  757. ;  inc  edi                                             ;? uncom ?
  758. .next_name:
  759.   cmp  [edx],byte 1
  760.   je   .no_find ;Group                                                          
  761.   inc  edx
  762.   dec  ecx
  763. .next:
  764.   mov  al,[edx]
  765.   mov  ah,[ebx]
  766.   cmp  ah,al
  767.   jne  .no_find
  768.   inc  edx
  769.   inc  ebx
  770.   dec  ecx
  771.   jne  .next
  772.   cmp  [edx],byte 0
  773.   jne  .no_find
  774.   ;find
  775.   mov  eax,esi
  776.   cmp  esi,9
  777.   ja   .letter
  778.   add  al,'0'
  779.   ret
  780. .letter:
  781.   add  al,'A'-10
  782.   ret
  783. .no_find:
  784.   cmp  [edx],byte 0
  785.   je   .go_next
  786.   inc  edx
  787.   jmp  .no_find
  788. .go_next:
  789.   dec  edi
  790.   je   .noting
  791.   mov  ebx,[esp+4]
  792.   mov  ecx,[esp]
  793.   inc  esi
  794.   jmp  .next_name
  795. .noting:
  796.   mov  al,'!'
  797.  pop  ecx ebx
  798.   ret
  799.    
  800. ;E:.
  801.    
  802. ;B+ Connect / Disconnect
  803. yahoo_c:
  804.   call connect
  805.   cmp  eax,0
  806.   jne  still ;not connected
  807.   mov  [is_connect],0x1
  808.   jmp  still
  809.    
  810. yahoo_d:
  811.   cmp  [is_connect],0x0
  812.   je   .noting
  813.    
  814.   call disconnect
  815.   ;
  816.   ;stop connection
  817.   mov  [is_connect],0x0
  818.   ;
  819.   ;clear text
  820.   mov  ah,27
  821.   call send_key_string
  822.   ;
  823.   ;clear friends
  824. ;  mov  [last_friend_line],0x0                          ;uncom
  825. ;  mov  [last_friend_place],friend_zone                 ;uncom
  826.   ;
  827.   ;set dafaut friend
  828.   mov  [f_name_b],fnb
  829.   mov  [f_name_l],10
  830.   mov  [view_text+1],'?'
  831.    
  832.   call draw_window
  833.    
  834. .noting:
  835.   jmp  still
  836.    
  837. is_connect dd 0x0
  838. ;E:.
  839.    
  840. ;B+ Load username / password
  841. input_username:
  842.   mov  edi,username
  843.   mov  [edi],byte '_'
  844.   inc  edi
  845.   mov  ecx,16-1
  846.   cld
  847. rep stosb
  848.   mov  [.unp],username
  849.    
  850. .next:
  851.   call show_username
  852.    
  853.   ;get enen
  854.   mov  eax,10
  855.   int  0x40
  856.    
  857.   cmp  eax,1
  858.   je   .end
  859.   cmp  eax,3
  860.   je   .end
  861.    
  862.   ;key
  863.   mov  eax,2
  864.   int  0x40
  865.    
  866.   cmp  ah,13
  867.   je   .end
  868.   cmp  ah,8
  869.   jne  .no_back
  870.   cmp  [.unp],username
  871.   je   .next
  872.   dec  [.unp]
  873.   mov  ebx,[.unp]
  874.   mov  [ebx],byte '_'
  875.   mov  [ebx+1],byte 0
  876.   jmp  .next
  877. .no_back:
  878.    
  879.   cmp  [.unp],username+16
  880.   je   .next
  881.    
  882.   cmp  ah,'0'
  883.   jb   .bad
  884.    
  885.   mov  ebx,[.unp]
  886.   mov  [ebx],ah
  887.   mov  [ebx+1],byte '_'
  888.   inc  [.unp]
  889.    
  890. .bad:
  891.   jmp  .next
  892. .end:
  893.   ;del cursor
  894.   mov  ebx,[.unp]
  895.   mov  [ebx],byte 0
  896.   call show_username
  897.   ;clear password
  898.   mov  [password],byte 0
  899.   ;hide password
  900.   mov  ebx,(2+41*6) shl 16 + v_sp-15-15
  901.   mov  ecx,[sys_colors+4*5]
  902.   mov  edx,f_password
  903.   mov  esi,4
  904.   mov  eax,4                                                                  
  905.   int  0x40
  906.   jmp  still
  907. .unp dd username
  908.    
  909. show_username:
  910.   ;hide
  911.   mov  ebx,(4+12*6-1) shl 16 + 16*6+1
  912.   mov  ecx,(v_sp-15-15) shl 16 + 9
  913.   mov  edx,[sys_colors+4*5]
  914.   mov  eax,13
  915.   int  0x40
  916.   ;show
  917.   mov  ebx,(4+12*6) shl 16 + v_sp-15-15
  918.   mov  ecx,[sys_colors+4*8]
  919.   mov  edx,username
  920.   mov  esi,16
  921.   mov  eax,4                                                                    
  922.   int  0x40
  923.   ret
  924.    
  925. username: times (16+1) db 0
  926.    
  927.    
  928.    
  929. input_password:
  930.   ;clear
  931.   mov  edi,password
  932.   mov  ecx,24
  933.   mov  al,0
  934.   cld
  935. rep stosb
  936.   mov  [.unp],password
  937.   ;hide password
  938.   mov  ebx,(2+41*6) shl 16 + v_sp-15-15
  939.   mov  ecx,[sys_colors+4*5]
  940.   mov  edx,f_password
  941.   mov  esi,4
  942.   mov  eax,4                                                                    
  943.   int  0x40
  944.    
  945. .next:
  946.   ;get enen
  947.   mov  eax,10
  948.   int  0x40
  949.    
  950.   cmp  eax,1
  951.   je   still
  952.   cmp  eax,3
  953.   je   still
  954.    
  955.   ;key
  956.   mov  eax,2
  957.   int  0x40
  958.    
  959.   cmp  [.unp],password+24
  960.   je   .no_next
  961.   cmp  ah,13
  962.   jne  .no_still
  963. .no_next:
  964.   call show_password
  965.   jmp  still
  966. .no_still:                                                                      
  967.    
  968.   mov  ebx,[.unp]
  969.   mov  [ebx],ah
  970.   inc  [.unp]
  971.   jmp  .next
  972.    
  973. .unp dd password
  974.    
  975. show_password:
  976.   cmp  [password],byte 0
  977.   je   .end
  978.   mov  ebx,(2+41*6) shl 16 + v_sp-15-15
  979.   mov  ecx,[sys_colors+4*8]
  980.   mov  edx,f_password
  981.   mov  esi,4
  982.   mov  eax,4                                                                    
  983.   int  0x40
  984. .end:
  985.   ret                                                                          
  986.    
  987. f_password db '####'
  988.    
  989. password: times (24+1) db 0
  990. ;E:.
  991.    
  992.    
  993.    
  994. ;B+ INTERNET
  995.    
  996. ;Functions:
  997.  ;call add_friend
  998.  ; ebx+1 - pointer to name
  999.  ;   [ebx]=1 - Group name
  1000.  ;   [ebx]=2 - Active user
  1001.  ;   [ebx]=other - Non active user
  1002.  ; ecx - length
  1003.  ;
  1004.  ;call show_message
  1005.  ; ebx - begin of string
  1006.  ; ecx - length
  1007.  ; -----
  1008.  ; NOTE Use format:
  1009.  ;  (<char>) <message>
  1010.  ;  where:
  1011.  ;   <char> - friend user char
  1012.  ;   <message> - message from friend
  1013.  ;
  1014.  ;call find_friend
  1015.  ; ebx - begin of name
  1016.  ; ecx - length
  1017.  ; ret:
  1018.  ; al - friend user char
  1019.  ; -----
  1020.  ; NOTE currenly don't show message if al='!'
  1021.                                                                                
  1022. ;Variables
  1023.  ;usernave (zero terminated)
  1024.  ;password (zero terminated)
  1025.  ;f_name_b - current friend user (to send)
  1026.  ;f_name_l - ^ length
  1027.    
  1028. ;Memory
  1029.  ; (friend_zone+32*fr_max_lines) < addr: [addr] - free
  1030.    
  1031.    
  1032. connect:
  1033.   ;conect to yahoo
  1034.   ;return 0 if OK
  1035.   ;return <>0 if some other event (sys.func.23)
  1036.   mov  eax,0
  1037.   ret
  1038.    
  1039. disconnect:                                                                    
  1040.   ;disconnect
  1041.   ret
  1042.    
  1043. check_message:
  1044.   ;test receive messages
  1045.   ret
  1046.    
  1047. ;E:.
  1048.    
  1049.    
  1050.    
  1051. ;B+ Test data                                           ;del
  1052. friend_zone:                                            ;del
  1053.  db 1,'First:',0                                        ;del
  1054.  db 2,'hahaha',0                                        ;del
  1055.  db 3,'second',0                                        ;del
  1056.  db 3,'menuetos',0                                      ;del
  1057.  db 1,'Treti:',0                                        ;del
  1058.  db 2,'fourth',0                                        ;del
  1059. fr_e db 0                                               ;del
  1060.                                                         ;del
  1061. times 200 db 0                                          ;del
  1062.                                                         ;del
  1063. last_friend_line dd 0x6                                 ;del
  1064. ;E:.                                                    ;del
  1065.    
  1066. ;B+ Data area
  1067. ;caption db 'Yahoo Messanger for MenuetOS'
  1068. caption db 'Messinger (Yahoo Compatible)'
  1069. caption_end:
  1070.    
  1071. ;User / Password
  1072. login_txt db 'STATUS:            SESSION: ___.___.___.___'
  1073.                      ;VISIBLE
  1074.                      ;HIDDEN
  1075. login_txt_end:
  1076. user_txt db 'USER ID ->'
  1077. user_txt_end:
  1078. psw_txt db 'PASSWORD ->'
  1079. psw_txt_end:
  1080. con_txt db 'CONNECT'
  1081. con_txt_end:
  1082. dis_txt db 'DISCONNECT'
  1083. dis_txt_end:
  1084.    
  1085. ;E:.
  1086. I_END:
  1087.