鱼C论坛

 找回密码
 立即注册
查看: 2017|回复: 1

[已解决]问题检测点6.1

[复制链接]
发表于 2018-6-8 18:44:50 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能^_^

您需要 登录 才可以下载或查看,没有账号?立即注册

x
本帖最后由 奥普瓯江 于 2018-6-8 18:44 编辑

我执行检测点6.1第二题
执行完毕后得到内存中的数据和0:0~0:15中的不一样最后两个“字”单位的数据变了我想知道为什么麻烦了
  1. assume cs:codesg
  2. codesg segment

  3.                 dw 0123h, 0456h, 0789h, 0abch, 0defh, 0fedh, 0cbah, 0987h
  4.                 dw 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
  5. start:        mov ax, cs
  6.                 mov ss, ax
  7.                 mov sp, 24h
  8.                
  9.                 mov ax, 0h
  10.                 mov ds, ax
  11.                 mov bx, 0h
  12.                 mov cx, 8h
  13.                 s:push [bx]
  14.                 pop cs:[bx]
  15.                 add bx, 2h
  16.                 loop s
  17.                
  18.                 mov ax, 4c00h
  19.                 int 21h
  20.                
  21. codesg ends
  22. end start
复制代码


0:0~0:15中的内存地址中的数据是
2018-6-8 18-23-10.png

执行到下面这个步骤
2018-6-8 18-25-04.png

执行完毕后得到的数据
2018-6-8 18-25-25.png

但是执行到{int 21h}这个步骤的时候数据是还没有变化的只有执行完了输入p按完回车后数据就不一样了
2018-6-8 18-39-40.png






最佳答案
2018-6-8 19:27:47
栈太小了

解决方案1
  1. assume cs:codesg
  2. codesg segment

  3.                 dw 0123h, 0456h, 0789h, 0abch, 0defh, 0fedh, 0cbah, 0987h
  4.                 dw 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
  5. start:
  6.                 mov        si, ss
  7.                 mov        bp, sp
  8.                
  9.                 mov ax, cs
  10.                 mov ss, ax
  11.                 mov sp, 24h
  12.                
  13.                 mov ax, 0h
  14.                 mov ds, ax
  15.                 mov bx, 0h
  16.                 mov cx, 8h
  17.                 s:push [bx]
  18.                 pop cs:[bx]
  19.                 add bx, 2h
  20.                 loop s
  21.                
  22.                
  23.                 mov        ss, si
  24.                 mov        sp, bp
  25.                
  26.                 mov ax, 4c00h
  27.                 int 21h
  28.                
  29. codesg ends
  30. end start
复制代码


解决方案2
  1. assume cs:codesg
  2. codesg segment

  3.                 dw 0123h, 0456h, 0789h, 0abch, 0defh, 0fedh, 0cbah, 0987h
  4.                 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
  5. stack_top:
  6. start:
  7.                 mov ax, cs
  8.                 mov ss, ax
  9.                 mov sp, stack_top
  10.                
  11.                 mov ax, 0h
  12.                 mov ds, ax
  13.                 mov bx, 0h
  14.                 mov cx, 8h
  15.                 s:push [bx]
  16.                 pop cs:[bx]
  17.                 add bx, 2h
  18.                 loop s
  19.                
  20.                 mov ax, 4c00h
  21.                 int 21h
  22.                
  23. codesg ends
  24. end start
复制代码
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复

使用道具 举报

发表于 2018-6-8 19:27:47 | 显示全部楼层    本楼为最佳答案   
栈太小了

解决方案1
  1. assume cs:codesg
  2. codesg segment

  3.                 dw 0123h, 0456h, 0789h, 0abch, 0defh, 0fedh, 0cbah, 0987h
  4.                 dw 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
  5. start:
  6.                 mov        si, ss
  7.                 mov        bp, sp
  8.                
  9.                 mov ax, cs
  10.                 mov ss, ax
  11.                 mov sp, 24h
  12.                
  13.                 mov ax, 0h
  14.                 mov ds, ax
  15.                 mov bx, 0h
  16.                 mov cx, 8h
  17.                 s:push [bx]
  18.                 pop cs:[bx]
  19.                 add bx, 2h
  20.                 loop s
  21.                
  22.                
  23.                 mov        ss, si
  24.                 mov        sp, bp
  25.                
  26.                 mov ax, 4c00h
  27.                 int 21h
  28.                
  29. codesg ends
  30. end start
复制代码


解决方案2
  1. assume cs:codesg
  2. codesg segment

  3.                 dw 0123h, 0456h, 0789h, 0abch, 0defh, 0fedh, 0cbah, 0987h
  4.                 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
  5. stack_top:
  6. start:
  7.                 mov ax, cs
  8.                 mov ss, ax
  9.                 mov sp, stack_top
  10.                
  11.                 mov ax, 0h
  12.                 mov ds, ax
  13.                 mov bx, 0h
  14.                 mov cx, 8h
  15.                 s:push [bx]
  16.                 pop cs:[bx]
  17.                 add bx, 2h
  18.                 loop s
  19.                
  20.                 mov ax, 4c00h
  21.                 int 21h
  22.                
  23. codesg ends
  24. end start
复制代码
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

小黑屋|手机版|Archiver|鱼C工作室 ( 粤ICP备18085999号-1 | 粤公网安备 44051102000585号)

GMT+8, 2024-4-20 19:32

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表