首页 > 其他 > 详细

assembly x86(nasm)的日常

时间:2019-06-05 22:47:40      阅读:127      评论:0      收藏:0      [点我收藏+]

cs的日常打卡。

技术分享图片

 

 

data    segment
ENG         db    SUNdayS Coming I Wanna Drive My Car,SUN,SUN$        ;43,35
sun1        db    SUN
swcount        db    0ah,0dh,single word number:,?,?,$
suncount    db    0ah,0dh,SUN:,?,$
data    ends
code    segment
assume    cs:code,ds:data,es:data
start:
            mov    ax,data
            mov    ds,ax    
            mov    es,ax        
            lea dx,ENG        
            mov    ah,9                        
            int    21h
swcount1:                                        
            mov al,ENG[si]
            cmp al,$
            jz     output1
            cmp al,A
            jb     next
            cmp al,Z
            ja     text1
            jmp addswc
text1:        cmp al,a
            jb     next
            cmp al,z
            ja     next
addswc:        inc swcount[21]
            cmp al,S
            jz  strcmp
            jmp next
to:
            pop si
next:        inc si
            jmp swcount1
strcmp:
            push si
            cld
            xor di,di
            lea di,sun1
            lea si,ENG[si]
            mov cx,3
            repz cmpsb
            jnz addcount
            inc suncount[6]
addcount:    
            jmp to

output1:
            xor cx,cx    
            mov al,swcount[21]
            cbw
loopb:
            xor dx,dx
            inc cl
            mov bx,10
            div bx                    ;ax商,dx余
            push dx                    ;余数入栈
            cmp ax,0
            jne loopb
            xor si,si
loopc: 
            pop dx
            or  dl,00110000b
            mov swcount[21+si],dl
            inc si
            loop loopc

            lea dx,swcount    
            mov    ah,9                        
            int    21h                
            or suncount[6],00110000b
            lea dx,suncount
            mov    ah,9                        
            int    21h            
exit:        mov    ah,4ch                        
            int    21h
code    ends
end    start

 

assembly x86(nasm)的日常

原文:https://www.cnblogs.com/lanclot-/p/10981918.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!