⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 airc.asm

📁 menuet os应用程序源代码,很多汇编写的应用程序
💻 ASM
📖 第 1 页 / 共 3 页
字号:
    jne  first_letter_found
    inc  edx
    jmp  search_first_letter
  first_letter_found:

    mov  esi,edx
    mov  edi,channel_list
    add  edi,ebx
    mov  ecx,30
    xor  eax,eax
  newcase:
    mov  al,[esi]
    cmp  eax,'a'
    jb   nocdec
    cmp  eax,'z'
    jg   nocdec
    sub  al,97-65
  nocdec:
    mov  [edi],al
    inc  esi
    inc  edi
    loop newcase

    popa

    ret


create_channel_window:

    pusha

    mov  [cursor_on_off],0

    mov  [thread_nro],eax

    mov  eax,51
    mov  ebx,1
    mov  ecx,channel_thread
    mov  edx,[thread_stack]
    int  0x40

    mov  eax,5
    mov  ebx,10
    int  0x40

    add  [thread_stack],0x4000
    add  [thread_screen],120*80

    popa

    ret


print_entry:

    pusha

    mov  eax,13
    mov  ebx,8*65536+6*80
    mov  ecx,151*65536+13
    mov  edx,0xffffff
    int  0x40

    mov  eax,4
    mov  ebx,8*65536+154
    mov  ecx,0x000000
    mov  edx,send_string
    mov  esi,[xpos]
    int  0x40

    popa

    ret

blink dd 0x0

blink_cursor:

    pusha

    mov  eax,9
    mov  ebx,0xe0000
    mov  ecx,-1
    int  0x40

    mov  edx,[blink]
    and  edx,1
    sub  edx,1
    and  edx,0xffffff
;    mov  edx,0

    cmp  ax,word [0xe0000+4]
    jne  no_blink

    call print_entry

    mov  ebx,[xpos]
    imul ebx,6
    add  ebx,8
    mov  cx,bx
    shl  ebx,16
    mov  bx,cx
    mov  ecx,151*65536+163
    mov  eax,38
    int  0x40

    popa

    ret

  no_blink:

    mov  eax,13
    mov  ebx,8*65536+6*60
    mov  ecx,151*65536+13
    mov  edx,0xffffff
    int  0x40

    popa

    ret





set_channel:

    pusha

    ; UPPER / LOWER CASE CHECK

    mov  esi,eax
    mov  edi,channel_temp
    mov  ecx,40
    xor  eax,eax
  newcase2:
    mov  al,[esi]
    cmp  eax,'#'
    jb   newcase_over2
    cmp  eax,'a'
    jb   nocdec2
    cmp  eax,'z'
    jg   nocdec2
    sub  al,97-65
  nocdec2:
    mov  [edi],al
    inc  esi
    inc  edi
    loop newcase2
  newcase_over2:
    sub  edi,channel_temp
    mov  [channel_temp_length],edi

    mov  eax,channel_temp

    mov  [text_start],I_END+120*80
    mov  ebx,channel_list+32
    mov  eax,[eax]

    mov  edx,[channel_temp_length]

  stcl1:
    cmp  dl,[ebx+31]
    jne  notfound

    pusha
    xor  eax,eax
    xor  edx,edx
    mov  ecx,0
  stc4:
    mov  dl,[ebx+ecx]
    mov  al,[channel_temp+ecx]
    cmp  eax,edx
    jne  notfound2
    inc  ecx
    cmp  ecx,[channel_temp_length]
    jb   stc4
    popa

    jmp  found

  notfound2:
    popa

  notfound:
    add  [text_start],120*80
    add  ebx,32
    cmp  ebx,channel_list+19*32
    jb   stcl1

    mov  [text_start],I_END

  found:

    popa

    ret


channel_temp:         times   100   db   0
channel_temp_length   dd      0x0



print_nick:

    pusha

    mov  eax,command+1
    mov  dl,'!'
    call print_text

    popa
    ret


analyze_command:

    pusha

    mov  [text_start],I_END
    mov  ecx,[rxs]
    imul ecx,11
    mov  [pos],ecx

    mov  bl,13
;  call print_character
    mov  bl,10
;  call print_character

    mov  ecx,[cmd]
    sub  ecx,2
    mov  esi,command+0
  newcmdc:
    mov  bl,[esi]
;  call print_character
    inc  esi
    loop newcmdc

    mov   edx,I_END
;  call  draw_channel_text

    cmp  [cmd],20
    jge  cmd_len_ok

    mov  [cmd],0

    popa
    ret


  cmd_len_ok:

    cmp  [command],dword 'PING'  ; ping response
    jne  no_ping_responce

    call print_command_to_main

    mov  [command],dword 'PONG'

    call print_command_to_main

    mov  eax,4
    mov  ebx,100*65536+3
    mov  ecx,0xffffff
    mov  edx,command
    mov  esi,[cmd]
    mov  [command+esi-1],word '**'
;    int  0x40

    mov  eax,53
    mov  ebx,7
    mov  ecx,[socket]
    mov  edx,[cmd]
    sub  edx,2
    and  edx,255
    mov  esi,command
    int  0x40

    mov  eax,53
    mov  ebx,7
    mov  ecx,[socket]
    mov  edx,2
    mov  esi,linef
    int  0x40

    popa
    ret

  linef  db  13,10

  no_ping_responce:

    mov  eax,[rxs]
    imul eax,11
    mov  [pos],eax

    mov  [command],byte '<'

    mov  eax,command
    mov  ecx,100
   new_blank:
    cmp  [eax],byte ' '
    je   bl_found
    inc  eax
    loop new_blank
    mov  eax,50
  bl_found:

    inc  eax
    mov  [command_position],eax

    mov  esi,eax
    mov  edi,irc_command
    mov  ecx,8
    cld
    rep  movsb


    cmp  [irc_command],'PRIV'  ; message to channel
    jne  no_privmsg

    ; compare nick

    mov  eax,[command_position]
    add  eax,8
    call compare_to_nick
    cmp  [cresult],0
    jne  no_query_msg
    mov  eax,command+1
  no_query_msg:
    call set_channel

    mov  ecx,100 ; [cmd]
    mov  eax,[command_position]
  acl3:
    cmp  [eax],byte ':'
    je   acl4
    inc  eax
    loop acl3
    mov  eax,10
  acl4:
    inc  eax

    cmp  [eax+1],dword 'ACTI'
    jne  no_action
    push eax
    mov  eax,action_header_short
    mov  dl,0
    call print_text
    mov  eax,command+1
    mov  dl,'!'
    call print_text
    mov  bl,' '
    call print_character
    pop  eax
    add  eax,8
    mov  dl,0
    call print_text
    popa
    ret

  no_action:

    push eax
    mov  bl,10
    call print_character
    mov  eax,command
    mov  dl,'!'
    call print_text
    mov  bl,'>'
    call print_character
    mov  bl,' '
    call print_character
    pop  eax

    mov  dl,0
    call print_text

    popa
    ret

  no_privmsg:


    cmp  [irc_command],'PART'    ; channel leave
    jne  no_part

    ; compare nick

    mov  eax,command+1
    call compare_to_nick
    cmp  [cresult],0
    jne  no_close_window

    mov  eax,[command_position]
    add  eax,5
    call set_channel

    mov  eax,[text_start]
    mov  [eax+120*60+4],byte 1

    popa
    ret

  no_close_window:

    mov  eax,[command_position]
    add  eax,5
    call set_channel

    mov  eax,action_header_red
    mov  dl,0
    call print_text
    mov  eax,command+1
    mov  dl,'!'
    mov  cl,' '
    call print_text
    mov  eax,has_left_channel
    mov  dl,0
    call print_text
    mov  eax,[command_position]
    add  eax,5
    mov  dl,' '
    call print_text

    popa
    ret

  no_part:


    cmp  [irc_command],'JOIN'    ; channel join
    jne  no_join

    ; compare nick

    mov  eax,command+1
    call compare_to_nick
    cmp  [cresult],0
    jne  no_new_window

    mov  edi,I_END+120*80
    mov  eax,1 ; create channel window - search for empty slot
   newse:
    mov  ebx,eax
    shl  ebx,5
    cmp  dword [channel_list+ebx],dword '    '
    je   free_found
    add  edi,120*80
    inc  eax
    cmp  eax,[max_windows]
    jb   newse

  free_found:

    mov  edx,[command_position]
    add  edx,6

    push eax
    push edx
    mov  ecx,0
   finde:
    inc  ecx
    inc  edx
    movzx eax,byte [edx]
    cmp  eax,'#'
    jge  finde
    mov  [channel_list+ebx+31],cl
    pop  edx
    pop  eax

    call create_channel_name

    push edi
    push eax
    mov  [edi+120*60+8],byte 0 ; channel window
    mov  eax,32
    mov  ecx,120*60
    cld
    rep  stosb
    pop  eax
    pop  edi

    ; eax has the free position
    mov  [thread_screen],edi
    call create_channel_window

  no_new_window:

    mov  eax,[command_position]
    add  eax,6
    call set_channel

    mov  eax,action_header_blue
    mov  dl,0
    call print_text
    mov  eax,command+1
    mov  dl,'!'
    mov  cl,' '
    call print_text

    mov  eax,joins_channel
    mov  dl,0
    call print_text

    mov  eax,[command_position]
    add  eax,6
    mov  dl,0
    call print_text

    popa
    ret

  no_join:


    cmp  [irc_command],'NICK'      ; nick change
    jne  no_nick_change

    mov  [text_start],I_END
    add  [text_start],120*80

 new_all_channels3:

    mov  eax,action_header_short
    mov  dl,0
    call print_text
    mov  eax,command+1
    mov  dl,'!'
    call print_text
    mov  eax,is_now_known_as
    mov  dl,0
    call print_text
    mov  eax,[command_position]
    add  eax,6
    mov  dl,0
    call print_text

    add  [text_start],120*80
    cmp  [text_start],I_END+120*80*20
    jb   new_all_channels3

    popa
    ret

  no_nick_change:


     cmp  [irc_command],'KICK'      ; kick
     jne  no_kick

    mov  [text_start],I_END
    add  [text_start],120*80

    mov  eax,[command_position]
    add  eax,5
    call set_channel

; new_all_channels4:

    mov  eax,action_header_short
    mov  dl,0
    call print_text
    mov  eax,command+1
    mov  dl,'!'
    call print_text
     mov  eax,kicked
     mov  dl,0
    call print_text
    mov  eax,[command_position]
    add  eax,5
    mov  dl,0
    call print_text

;    add  [text_start],120*80
;    cmp  [text_start],I_END+120*80*20
;    jb   new_all_channels4

    popa
    ret

  no_kick:




    cmp  [irc_command],'QUIT'    ; irc quit
    jne  no_quit

    mov  [text_start],I_END
    add  [text_start],120*80

 new_all_channels2:

    mov  eax,action_header_red
    mov  dl,0
    call print_text
    mov  eax,command+1
    mov  dl,'!'
    call print_text
    mov  eax,has_quit_irc
    mov  dl,0
    call print_text

    add  [text_start],120*80
    cmp  [text_start],I_END+120*80*20
    jb   new_all_channels2

    popa
    ret

  no_quit:


    cmp  [irc_command],dword 'MODE'  ; channel mode change
    jne  no_mode

    mov  [text_start],I_END
    add  [text_start],120*80

    mov  eax,[command_position]
    add  eax,5
    call set_channel

 new_all_channels:

    mov  eax,action_header_short
    mov  dl,0
    call print_text

    call print_nick

    mov  eax,sets_mode
    mov  dl,0
    call print_text

    mov  eax,[command_position]
    add  eax,5
    mov  dl,0
    call print_text

;    add  [text_start],120*80
;    cmp  [text_start],I_END+120*80*20
;    jb   new_all_channels

    popa
    ret

  no_mode:


    cmp  [irc_command],dword '353 '  ; channel user names
    jne  no_user_list

    mov  eax,[command_position]
   finde2:
    inc  eax
    cmp  [eax],byte '#'
    jne  finde2
    call set_channel

   finde3:
    inc  eax
    cmp  [eax],byte ':'
    jne  finde3

    pusha
    cmp  [user_list_pos],0
    jne  no_clear_user_list
    mov  edi,[text_start]
    add  edi,120*70
    mov  [edi-8],dword 0
    mov  [edi-4],dword 0
    mov  eax,32
    mov  ecx,1200
    cld
    rep  stosb
  no_clear_user_list:
    popa

    push eax

    mov  esi,eax
    inc  esi
    mov  edi,[text_start]
    add  edi,120*70
    add  edi,[user_list_pos]
    mov  edx,edi
    mov  ecx,command
    add  ecx,[cmd]
    sub  ecx,[esp]
    sub  ecx,3
    and  ecx,0xfff
    cld
    rep  movsb

    pop  eax
    mov  ebx,command
    add  ebx,[cmd]
    sub  ebx,eax
    sub  ebx,2
    mov  [edx+ebx-1],dword '    '

    add  [user_list_pos],ebx

    mov  eax,[user_list_pos]
    mov  ebx,[text_start]
    add  ebx,120*70
    mov  [ebx-4],eax

    popa
    ret

  user_list_pos dd 0x0

  no_user_list:


    cmp  [irc_command],dword '366 '  ; channel user names end
    jne  no_user_list_end

    mov  [user_list_pos],0

    popa
    ret

  no_user_list_end:

    mov  [command],byte '-'
    call print_command_to_main

    popa

    ret


cresult db 0

compare_to_nick:

; input  : eax = start of compare
; output : [cresult] = 0 if match, [cresult]=1 if no match


    pusha

    mov  esi,eax
    mov  edi,0

  new_nick_compare:

    mov  bl,byte [esi]
    mov  cl,byte [user_nick+4+edi]

    cmp  bl,cl
    jne  nonickm

    add  esi,1
    add  edi,1

    cmp  edi,[user_nick]
    jb   new_nick_compare

    movzx eax,byte [esi]
    cmp  eax,40
    jge  nonickm

    popa
    mov  [cresult],0
    ret

  nonickm:

    popa
    mov  [cresult],1
    ret





print_command_to_main:

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -