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

📄 nntpc.asm

📁 menuet os应用程序源代码,很多汇编写的应用程序
💻 ASM
📖 第 1 页 / 共 2 页
字号:
    cld
    rep  stosb
    mov  eax,[article_last]
    sub  eax,[article_start]
    mov  [article_all],eax
    mov  esi,article_all
    mov  edi,text+10+66*3
    call convert_number_to_text
    call draw_entries
    popa

    call draw_text

  no_stat_ret:

    inc  [status]

    mov  eax,5
    mov  ebx,10
    int  0x40

    call check_for_incoming_data

  no_match:

    ret



START:                          ; start of execution

     mov  eax,40
     mov  ebx,10000111b
     int  0x40

     call clear_text

     call draw_window

still:

    call state_machine_write
    call state_machine_read

    mov  eax,23                 ; wait here for event
    mov  ebx,5
    int  0x40

    cmp  eax,1                  ; redraw request ?
    je   red
    cmp  eax,2                  ; key in buffer ?
    je   key
    cmp  eax,3                  ; button in buffer ?
    je   button

    call check_for_incoming_data

    call connection_status

    jmp  still

  red:                          ; redraw
    call draw_window
    jmp  still

  key:                          ; key
    mov  eax,2                  ; just read it and ignore
    int  0x40

    cmp  ah,' '
    jne  no_space
    mov  eax,[space]
    dec  eax
    add  [text_start],eax
    call draw_text
    jmp  still
  no_space:

    cmp  ah,177
    jne  no_plus
    inc  [text_start]
    call draw_text
    jmp  still
  no_plus:

    cmp  ah,178
    jne  no_minus
    cmp  [text_start],0
    je   no_minus
    dec  [text_start]
    call draw_text
    jmp  still
  no_minus:

    cmp  ah,179
    jne  no_next
    inc  [text_current]
    call send_group
    jmp  still
  no_next:

    cmp  ah,176
    jne  no_prev
    cmp  [text_current],0
    je   still
    dec  [text_current]
    call send_group
    jmp  still
  no_prev:

    jmp  still


  button:                       ; button
    mov  eax,17                 ; get id
    int  0x40

    shr  eax,8

    cmp  eax,11
    jne  no_11
    mov  edi,text+10
    call text_input
    call convert_text_to_ip
    jmp  still
   no_11:

    cmp  eax,12
    jne  no_12
    mov  edi,text+66+10
    call text_input
    mov  esi,text+66+10
    mov  edi,group+6
    mov  ecx,[xpost]
    sub  ecx,text+66+10
    mov  eax,ecx
    cld
    rep  movsb
    mov  [group+6+eax],byte 13
    mov  [group+7+eax],byte 10
    add  eax,6+2
    mov  [grouplen],eax
    mov  [text_current],0
    jmp  still
   no_12:

    cmp  eax,13
    jne  no_13
    mov  edi,text+10+66*2
    call text_input
    mov  esi,text+10+66*2
    mov  edi,text_current
    call convert_text_to_number
    call send_group
    jmp  still
   no_13:


    cmp  eax,14
    jne  no_start
    call clear_text
    mov  eax,3
    int  0x40
    mov  ecx,eax
    mov  eax,53
    mov  ebx,5
    mov  edx,119
    mov  esi,dword [server_ip]
    mov  edi,1
    int  0x40
    mov  [socket],eax
    mov  [status],1
    jmp  still
  no_start:

    cmp  eax,15
    jne  no_end
    mov  eax,53
    mov  ebx,7
    mov  ecx,[socket]
    mov  edx,quitlen-quit
    mov  esi,quit
    int  0x40
    mov  eax,5
    mov  ebx,10
    int  0x40
    call check_for_incoming_data
    mov  eax,53
    mov  ebx,8
    mov  ecx,[socket]
    int  0x40
    mov  eax,5
    mov  ebx,5
    int  0x40
    mov  eax,53
    mov  ebx,8
    mov  ecx,[socket]
    int  0x40
    mov  [status],0
    jmp  still
  no_end:

    cmp  eax,1                   ; button id=1 ?
    jne  noclose
    mov  eax,-1                 ; close this program
    int  0x40
  noclose:

    jmp  still


check_for_incoming_data:

    cmp  [status],0
    jne  go_on
    ret
  go_on:

    mov  eax,53
    mov  ebx,2
    mov  ecx,[socket]
    int  0x40

    cmp  eax,0
    je   ch_ret

    mov  eax,53
    mov  ebx,3
    mov  ecx,[socket]
    int  0x40

    and  ebx,0xff

    cmp  ebx,13
    jb   no_print

    cmp  bl,13
    jne  char
    mov  [xpos],0
    inc  [ypos]
    jmp  no_print
  char:

    cmp  ebx,128
    jbe  char_ok
    mov  ebx,'?'
  char_ok:

    mov  ecx,[ypos]
    imul ecx,80
    add  ecx,[xpos]
    mov  [nntp_text+ecx],bl
    cmp  [xpos],78
    jg   noxinc
    inc  [xpos]
  noxinc:

  no_print:

    mov  eax,53
    mov  ebx,2
    mov  ecx,[socket]
    int  0x40

    cmp  eax,0
    jne  check_for_incoming_data

    call draw_text

  ch_ret:

    ret



;   *********************************************
;   *******  WINDOW DEFINITIONS AND DRAW ********
;   *********************************************


draw_window:

    pusha

    mov  [prev_state],-1

    mov  eax,12                    ; function 12:tell os about windowdraw
    mov  ebx,1                     ; 1, start of draw
    int  0x40

                                   ; DRAW WINDOW
    mov  eax,0                     ; function 0 : define and draw window
    mov  ebx,100*65536+520         ; [x start] *65536 + [x size]
    mov  ecx,5*65536+470           ; [y start] *65536 + [y size]
    mov  edx,0x03ffffff            ; color of work area RRGGBB,8->color gl
    mov  esi,0x805080d0            ; color of grab bar  RRGGBB,8->color gl
    mov  edi,0x005080d0            ; color of frames    RRGGBB
    int  0x40

    mov  eax,38
    mov  ebx,5*65536+515
    mov  ecx,101*65536+101
    mov  edx,0x99bbff
    int  0x40
    mov  eax,38
    mov  ebx,5*65536+515
    mov  ecx,102*65536+102
    mov  edx,0x3366aa
    int  0x40

                                   ; WINDOW LABEL
    mov  eax,4                     ; function 4 : write text to window
    mov  ebx,8*65536+8             ; [x start] *65536 + [y start]
    mov  ecx,0x10ddeeff            ; font 1 & color ( 0xF0RRGGBB )
    mov  edx,labelt                ; pointer to text beginning
    mov  esi,labellen-labelt       ; text length
    int  0x40

    mov  eax,8
    mov  ebx,238*65536+8
    mov  ecx,30*65536+8
    mov  edx,11
    mov  esi,0x88aadd
    int  0x40
    mov  eax,8
    mov  ebx,238*65536+8
    mov  ecx,41*65536+8
    mov  edx,12
    int  0x40
    mov  eax,8
    mov  ebx,238*65536+8
    mov  ecx,52*65536+8
    mov  edx,13
    int  0x40

    mov  eax,8
    mov  ebx,265*65536+75
    mov  ecx,39*65536+13
    mov  edx,14
    int  0x40
    mov  eax,8
    mov  ebx,351*65536+75
    mov  ecx,39*65536+13
    mov  edx,15
    int  0x40

    call draw_entries

    call draw_text

    mov  eax,12                    ; function 12:tell os about windowdraw
    mov  ebx,2                     ; 2, end of draw
    int  0x40

    popa

    ret


draw_entries:

    pusha

    mov  eax,13
    mov  ebx,30*65536+200
    mov  ecx,30*65536+44
    mov  edx,0xffffff
    int  0x40

    mov  ebx,30*65536+31           ; draw info text with function 4
    mov  ecx,0x000000
    mov  edx,text
    mov  esi,66
    mov  edi,6

  newline2:

    mov  eax,4
    int  0x40
    add  ebx,11
    add  edx,66
    dec  edi
    jnz  newline2

    popa

    ret


draw_text:

    pusha

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

    mov  eax,[0x70000+46]
    cmp  eax,150
    jbe  dtret

    sub  eax,111
    mov  ebx,10
    xor  edx,edx
    div  ebx
    mov  edi,eax
    dec  edi

    mov  [space],edi

    mov  ebx,20*65536+111           ; draw info text with function 4
    mov  ecx,0x000000
    mov  edx,[text_start]
    imul edx,80
    add  edx,nntp_text
    mov  esi,80
  newline:

    pusha
    mov  ecx,ebx
    shl  ecx,16
    mov  eax,13
    mov  ebx,20*65536+80*6
    mov  cx,10
    mov  edx,0xffffff
    int  0x40
    popa

    mov  eax,4
    int  0x40
    add  ebx,10
    add  edx,80
    dec  edi
    jnz  newline

  dtret:

    popa

    ret


; DATA AREA

text:
 db 'NNTP IP : 192.168.0.96             <                              '
 db 'Group   : alt.test                 <      Connect      Disconnect '
 db 'Article : 0                        <                              '
 db 'Art.max : ?                                                       '
 db '                                                                  '
 db 'Arrow left/rigth: fetch prev/next - Arrow up/down & space: scroll '

textl:


labelt:
     db   'NNTP client v',version
labellen:

nntp_text:

     db 'a'

I_END:   ;;;

⌨️ 快捷键说明

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