


上天安排我做了个多情的人,却又安排我遭遇了无数绝情的人,所以我最终把自己磨练成了一个滥情的人。别人是人见人爱,我是见人爱人.......
;*********** data segment result dw ? data ends ;*********** code segment assume cs:code,ds:data start: push ds ; sub ax,ax push ax mov ax,data ;数据段寻址 mov ds,ax mov cx,100 ;CX自动计数 sub ax,ax ;清空AX, lop: inc ax add bx,ax loop lop ;累加 mov result,bx ;保存结果 mov ch,4 aa: mov cl,4 rol bx,cl ;取bx高4位 mov al,bl ;从这以后就看不明白了?????? and al,0fh add al,30h cmp al,3ah jl printit add al,7h printit: mov dl,result mov ah,2 int 21h dec ch jnz aa retf code ends ;*********** end start
;*********** data segment result dw ? data ends ;*********** code segment assume cs:code,ds:data start: push ds ; sub ax,ax push ax mov ax,data ;数据段寻址 mov ds,ax mov cx,100 ;CX自动计数 sub ax,ax ;清空AX, lop: inc ax add bx,ax loop lop ;累加 mov result,bx ;保存结果 mov ch,4 aa: mov cl,4 rol bx,cl ;取bx高4位 mov al,bl ; and al,0fh ; add al,30h ; 转化成ASCLL码 cmp al,3ah ; 是否小于'9' jl printit ; 如果是,打印出来 add al,7h ; 加7就变成A B C D E F等值 printit: mov dl,result ; 把结果放入dl mov ah,2 ; 调用2号中断输出字符 int 21h dec ch ; ch-- jnz aa ; 累加器不为0,则跳到aa继续执行 retf ; 退出 code ends ;*********** end start