Subversion Repositories Kolibri OS

Rev

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