Subversion Repositories Kolibri OS

Rev

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