王爽的汇编弟六章 实验五(6)

来源:百度知道 编辑:UC知道 时间:2024/06/08 03:12:24
assume cs:code

a segment
dw 1,2,3,4,5,6,7,8,9,0ah,0bh,0ch,0dh,0eh,0fh,0ffh
a ends

b segment
dw 0,0,0,0,0,0,0,0,
b ends

code segment
start: mov bx,0
mov cx,16

mov ax,b
mov ss,ax
mov sp,30h

mov ax,a
mov ds,ax

s: push ds:[bx]
add bx,2
loop s

mov ax,4c00h
int 21h

code ends
end start
有一个错误,运行到mov sp,30h后SP变30但再往后就进行不了了怎么回是啊跪求
题目是用PUSH将A中前8个逆序存B中

请查阅,王爽汇编第3章的 实验2 中的相关内容
当你用DEBUG跟踪程序的时候,mov ss,ax mov sp,30h这两条指令是被同时执行的,用T单步跟踪就会产生错误.

你的程序应该没什么问题.但你说要用PUSH将A中前8个逆序保存,那mov cx,16这句应该改成mov cx,8啊,要么B数据段得有16个字的空间.