鱼C论坛

 找回密码
 立即注册
查看: 1550|回复: 0

[技术交流] 求汇编大神翻译代码!谢谢拉~~~

[复制链接]
发表于 2014-12-11 10:48:31 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能^_^

您需要 登录 才可以下载或查看,没有账号?立即注册

x
Data segment                       
  string1  db 'Input your string:$
  string2  db 'Digit:$'  
  string3  db 'Letter:$'  
  string4  db 'Other:$'
  
  Digit   db 0  
  Letter  db 0  
  Other  db 0
data  ends
  
prognam  segment  
main  proc  far      
  assume cs:prognam,ds:data

start:  
  push  ds                  
  sub  ax,ax  
  push  ax

  mov  ax,data  
  mov  ds,ax   
  lea    dx,string1            

  mov  ah,9  
  int   21h

  mov  cx,80

L1:  
  mov  ah,1                  
  int   21h  

  cmp  al,0dh                  
  jz   over
   
  cmp  al,30h                 
  jb   others  

  cmp  al,39h            
  ja   L2   

  jmp  digits                  

L2:   
  cmp  al,41h                  
  jb   others   

  cmp  al,5ah               
  ja   L3   
  jmp  letters                 

L3:  
  cmp  al,61h                  
  jb   others  

  cmp   al,7ah               
  ja   others   

  jmp  letters                 

digits:   
  inc   digit  
  jmp  over1
others:   
  inc   other  
  jmp  over1
letters:   
  inc   letter
  jmp   over1  

over1:   
  loop L1  

over:   
  call  endline  
  lea  dx,string2               

  mov  ah,9
  int   21h

  sub  ax,ax

  mov  al,digit

  call  display
  call  endline  

  lea  dx,string3           
  mov  ah,9
  int  21h  
  sub   ax,ax
  mov  al,letter
  call  display
  call  endline  

  lea  dx,string4              
  mov  ah,9
  int  21h  
  sub   ax,ax
  mov  al,other
  call  display
  ret  
main  endp


endline  proc  near         
  mov  ah,2
  mov  dl,0ah
  int  21h

  mov  ah,2
  mov dl,0dh
  int  21h
  ret
endline   endp   
display   proc  near         
  mov  dl,al                  

  add   dl,30h               
  mov  ah,2
  int  21h
ret
display   endp

prognam  ends  
end  start
这是老师布置的一端代码!求大神能在每段代码前做上注释。并具体分析这段代码是做什么的,包括哪段调用哪段~
谢谢了

想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

小黑屋|手机版|Archiver|鱼C工作室 ( 粤ICP备18085999号-1 | 粤公网安备 44051102000585号)

GMT+8, 2024-10-7 00:21

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表