第六章 包含多个段的程序_利用栈逆序存放数据_测试出现乱码
本帖最后由 zy8818 于 2018-1-28 21:50 编辑assume cs:codesg
codesg segment
dw 0123h,0456h,0789h,0abch,0defh,0fedh,0bah,0987h
dw 0,0,0,0,0,0,0,0
start: mov ax,cs
mov ss,ax
mov sp,20h
mov bx,0
mov cx,8
s: push cs:
add bx,2
loop s
mov bx,0
mov cx,8
s1: pop cs:
add bx,2
loop s1
mov ax,4c00h
int 21h
codesg ends
end start
执行了mov ss,ax之后栈数据出现乱码
执行到mov ax,4c00h时结果也是不正常的
不知道是哪里出错了,这个是在xp 虚拟机里面跑的,谁知道错在哪里,指点一下,感激不尽,卡壳了……静静等候佳音 本帖最后由 cnkizy 于 2018-1-28 13:40 编辑
涉及代码的部分贴代码不要贴图片
你想表达的是 修改了 ss 段寄存器后 ,有部分数据被改写了,对吧。虽然不影响运行结果,但是你不知道咋回事 cnkizy 发表于 2018-1-28 11:42
涉及代码的部分贴代码不要贴图片
{:10_257:}你这口气跟人造人一样了,哈哈哈哈哈哈哈! 兰陵月 发表于 2018-1-28 13:41
你这口气跟人造人一样了,哈哈哈哈哈哈哈!
^_^ 兰陵月 发表于 2018-1-28 13:41
你这口气跟人造人一样了,哈哈哈哈哈哈哈!
{:10_254:}方便调试嘛 cnkizy 发表于 2018-1-28 13:51
方便调试嘛
{:10_266:}{:10_266:} assume cs:code
code segment
dw 0123h,0456h,0789h,0abch,0defh,0fedh,0bah,0987h
dw 0,0,0,0,0,0,0,0
start: mov ax, cs
mov ss, ax
mov sp, 20h
mov bx,0
mov cx,8
s:
push cs:
add bx,2
loop s
mov bx,0
mov cx,8
s1: pop cs:
add bx,2
loop s1
mov ax, 4c00h
int 21h
code ends
end start 谁知道怎么回事 zy8818 发表于 2018-1-29 10:25
谁知道怎么回事
你确定是这个代码?我这边没有问题
assume cs:codesg
codesg segment
dw 0123h, 0456h, 0789h, 0abch, 0defh, 0fedh, 0bah, 0987h
dw 0, 0, 0, 0, 0, 0, 0, 0
start:
mov ax, cs
mov ss, ax
mov sp, 20h
mov bx, 0
mov cx, 8
s:
push cs:
add bx, 2
loop s
mov bx, 0
mov cx, 8
s1:
pop cs:
add bx, 2
loop s1
mov ax,4c00h
int 21h
codesg ends
end start
页:
[1]