编写一个程序,将一给定的数组中的数按正数和负数分别存入不同的数组中

coder_99 coder_99 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
这是代码:

data segment
num db 1,-5,3,-7,9,8
num_z db ?;正数数组
num_f db ?;负数数组
data ends
stack1 segment para stack
dw 20h dup(0)
stack1 ends
code segment
assume cs:code,ds:data,ss:stack1
start:
mov ax,data
mov ds,ax
mov cx,6 ;循环判断六次。
mov si,0
xun:
cmp cx,1
jz cends
cmp num[si],0
js flag1 ;结果为负数时的转移。
jns flag2 ;结果为正数的转移。
dec cx ;cx减一
flag1:
mov num_f[di],num[si] ;将数据放入负数数组。
neg si ;si向后挪一位。
neg di
jmp xun ;返回判断。
flag2:
mov num_z[di],num[si] ;将数据放入正数数组。
neg si ;si向后挪一位。
neg di
jmp xun ;返回判断。
cends:
mov ah,4ch
int 21h
code ends
end start


Object filename [out.OBJ]:
Source listing [NUL.LST]:
Cross-reference [NUL.CRF]:
out.ASM(24): error A2052: Improper operand type
out.ASM(28): error A2006: Phase error between passes
out.ASM(29): error A2052: Improper operand type
out.ASM(33): error A2006: Phase error between passes

50136 + 449832 Bytes symbol space free

0 Warning Errors
4 Severe Errors

为什么会出现这种错误啊。
...全文

相关推荐

评论 4
收藏 已收藏
分享
返回顶部
coder_99
汇编语言 21,500 成员 41,619 内容