循环cx怎么从6 -> 0 -> ffff 了?
时间:2011-12-13
来源:互联网
data segment
M dw 0001h,0002h,0000h,0f234h,1455h,0fa69h
P dw 6 dup(?) ;正数存入此数组 di
N dw 6 dup(?) ;负数存入此数组
data ends
stack segment stack
buff dw 100 dup(?)
stack ends
code segment
;-------------------------------
main proc far
assume ds:data,cs:code,ss:stack
start:
push ds
sub ax,ax
push ax
mov ax,data
mov ds,ax
mov ax,stack
mov ss,ax
mov di,0
mov si,0
mov bx,0
mov cx,6
rotate:
mov ax,M[bx]
cmp ax,0
jl less
jg great
add bx,2
loop rotate
jmp print
less:
mov N[si],ax
add si,2
add bx,2
loop rotate
great:
mov P[di],ax
add di,2
add bx,2
loop rotate
print:
shr di,1
mov dx,di
add dx,30h
mov ah,02h
int 21h ;输出正数的个数
shr si,1
mov dx,si
add dx,30h
mov ah,02h
int 21h ;输出负数的个数?
ret
main endp
;------------------------------------
code ends
end start
M dw 0001h,0002h,0000h,0f234h,1455h,0fa69h
P dw 6 dup(?) ;正数存入此数组 di
N dw 6 dup(?) ;负数存入此数组
data ends
stack segment stack
buff dw 100 dup(?)
stack ends
code segment
;-------------------------------
main proc far
assume ds:data,cs:code,ss:stack
start:
push ds
sub ax,ax
push ax
mov ax,data
mov ds,ax
mov ax,stack
mov ss,ax
mov di,0
mov si,0
mov bx,0
mov cx,6
rotate:
mov ax,M[bx]
cmp ax,0
jl less
jg great
add bx,2
loop rotate
jmp print
less:
mov N[si],ax
add si,2
add bx,2
loop rotate
great:
mov P[di],ax
add di,2
add bx,2
loop rotate
print:
shr di,1
mov dx,di
add dx,30h
mov ah,02h
int 21h ;输出正数的个数
shr si,1
mov dx,si
add dx,30h
mov ah,02h
int 21h ;输出负数的个数?
ret
main endp
;------------------------------------
code ends
end start
作者: zk3389 发布时间: 2011-12-13
题目要求将数组N中的正数存入P数组,负数存入N数组,并输出原数组中正数,负数的个数,但我调试程序的时候发现cx为0的时候循环还在继续,并且还继续dec,ffff,fffe...
作者: zk3389 发布时间: 2011-12-13
相关阅读 更多
热门阅读
-
office 2019专业增强版最新2021版激活秘钥/序列号/激活码推荐 附激活工具
阅读:74
-
如何安装mysql8.0
阅读:31
-
Word快速设置标题样式步骤详解
阅读:28
-
20+道必知必会的Vue面试题(附答案解析)
阅读:37
-
HTML如何制作表单
阅读:22
-
百词斩可以改天数吗?当然可以,4个步骤轻松修改天数!
阅读:31
-
ET文件格式和XLS格式文件之间如何转化?
阅读:24
-
react和vue的区别及优缺点是什么
阅读:121
-
支付宝人脸识别如何关闭?
阅读:21
-
腾讯微云怎么修改照片或视频备份路径?
阅读:28