|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
本帖最后由 奥普瓯江 于 2018-6-8 18:44 编辑
我执行检测点6.1第二题
执行完毕后得到内存中的数据和0:0~0:15中的不一样最后两个“字”单位的数据变了我想知道为什么麻烦了
- assume cs:codesg
- codesg segment
- dw 0123h, 0456h, 0789h, 0abch, 0defh, 0fedh, 0cbah, 0987h
- dw 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
- start: mov ax, cs
- mov ss, ax
- mov sp, 24h
-
- mov ax, 0h
- mov ds, ax
- mov bx, 0h
- mov cx, 8h
- s:push [bx]
- pop cs:[bx]
- add bx, 2h
- loop s
-
- mov ax, 4c00h
- int 21h
-
- codesg ends
- end start
复制代码
0:0~0:15中的内存地址中的数据是
执行到下面这个步骤
执行完毕后得到的数据
但是执行到{int 21h}这个步骤的时候数据是还没有变化的只有执行完了输入p按完回车后数据就不一样了
栈太小了
解决方案1
- assume cs:codesg
- codesg segment
- dw 0123h, 0456h, 0789h, 0abch, 0defh, 0fedh, 0cbah, 0987h
- dw 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
- start:
- mov si, ss
- mov bp, sp
-
- mov ax, cs
- mov ss, ax
- mov sp, 24h
-
- mov ax, 0h
- mov ds, ax
- mov bx, 0h
- mov cx, 8h
- s:push [bx]
- pop cs:[bx]
- add bx, 2h
- loop s
-
-
- mov ss, si
- mov sp, bp
-
- mov ax, 4c00h
- int 21h
-
- codesg ends
- end start
复制代码
解决方案2
- assume cs:codesg
- codesg segment
- dw 0123h, 0456h, 0789h, 0abch, 0defh, 0fedh, 0cbah, 0987h
- dw 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
- stack_top:
- start:
- mov ax, cs
- mov ss, ax
- mov sp, stack_top
-
- mov ax, 0h
- mov ds, ax
- mov bx, 0h
- mov cx, 8h
- s:push [bx]
- pop cs:[bx]
- add bx, 2h
- loop s
-
- mov ax, 4c00h
- int 21h
-
- codesg ends
- end start
复制代码
|
|