鱼C论坛

 找回密码
 立即注册
查看: 2625|回复: 4

实验5的问题

 关闭 [复制链接]
发表于 2011-8-16 00:32:25 | 显示全部楼层 |阅读模式

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

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

x
本帖最后由 sslas 于 2011-8-16 10:45 编辑
AX=13EB  BX=0008  CX=0000  DX=0000  SP=0002  BP=0000  SI=0000  DI=0000
DS=13E9  ES=13D9  SS=13EB  CS=13EC  IP=001A   NV UP EI PL NZ NA PO NC
13EC:001A B8004C        MOV     AX,4C00
-t

Program terminated normally
-d 13e9:0
13E9:0000  01 00 02 00 03 00 04 00-05 00 06 00 07 00 08 00   ................
13E9:0010  09 00 0A 00 0B 00 0C 00-0D 00 0E 00 0F 00 FF 00   ................
13E9:0020  02 30 04 00 03 00 02 00-01 00 00 00 00 00 00 00   .0..............
13E9:0030  B8 E9 13 8E D8 B8 EB 13-8E D0 BC 0A 00 BB 00 00   ................
13E9:0040  B9 04 00 FF 37 83 C3 02-E2 F9 B8 00 4C CD 21 00   ....7.......L.!.
13E9:0050  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00   ................
13E9:0060  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00   ................
13E9:0070  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00   ................
-d 13EB:0
13EB:0000  02 30 04 00 03 00 02 00-01 00 00 00 00 00 00 00   .0..............
13EB:0010  B8 E9 13 8E D8 B8 EB 13-8E D0 BC 0A 00 BB 00 00   ................
13EB:0020  B9 04 00 FF 37 83 C3 02-E2 F9 B8 00 4C CD 21 00   ....7.......L.!.
13EB:0030  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00   ................
13EB:0040  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00   ................
13EB:0050  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00   ................
13EB:0060  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00   ................
13EB:0070  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00   ................


上面是实验5第六题在debug中调试结果,题目是用push指令将a段中的前8个字型数据逆序存放到b段中
可答案不正确啊 代码如下:
assume cs:code,ss:b,ds:a
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 ax,a
      mov ds,ax

      mov ax,b
      mov ss,ax
      mov sp,10

      mov bx,0
      mov cx,4
      s:push [bx]
      add bx,2
loop s

mov ax,4c00H
int 21H

code ends
end start
到底是那出错了呢?

想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
 楼主| 发表于 2011-8-16 00:46:30 | 显示全部楼层
cx改成8了 还是不对啊
AX=4C00  BX=0010  CX=0000  DX=0000  SP=FFFA  BP=0000  SI=0000  DI=0000
DS=13E9  ES=13D9  SS=13EB  CS=13EC  IP=001D   NV UP EI PL NZ AC PO NC
13EC:001D CD21          INT     21
-p

Program terminated normally
-d 13e9:0
13E9:0000  01 00 02 00 03 00 04 00-05 00 06 00 07 00 08 00   ................
13E9:0010  09 00 0A 00 0B 00 0C 00-0D 00 0E 00 0F 00 FF 00   ................
13E9:0020  05 00 04 00 03 00 02 00-01 00 00 00 00 00 00 00   ................
13E9:0030  B8 E9 13 8E D8 B8 EB 13-8E D0 BC 0A 00 BB 00 00   ................
13E9:0040  B9 08 00 FF 37 83 C3 02-E2 F9 B8 00 4C CD 21 CC   ....7.......L.!.
13E9:0050  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00   ................
13E9:0060  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00   ................
13E9:0070  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00   ................
-d 13e8:0
13E8:0000  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00   ................
13E8:0010  01 00 02 00 03 00 04 00-05 00 06 00 07 00 08 00   ................
13E8:0020  09 00 0A 00 0B 00 0C 00-0D 00 0E 00 0F 00 FF 00   ................
13E8:0030  05 00 04 00 03 00 02 00-01 00 00 00 00 00 00 00   ................
13E8:0040  B8 E9 13 8E D8 B8 EB 13-8E D0 BC 0A 00 BB 00 00   ................
13E8:0050  B9 08 00 FF 37 83 C3 02-E2 F9 B8 00 4C CD 21 CC   ....7.......L.!.
13E8:0060  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00   ................
13E8:0070  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00   ................
应该是这样的效果吧?
-d 13e8:0
13E8:0000  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00   ................
13E8:0010  08 00 07 00 06 00 05 00-04 00 03 00 02 00 01 00   ................
13E8:0020  09 00 0A 00 0B 00 0C 00-0D 00 0E 00 0F 00 FF 00   ................
13E8:0030  05 00 04 00 03 00 02 00-01 00 00 00 00 00 00 00   ................
13E8:0040  B8 E9 13 8E D8 B8 EB 13-8E D0 BC 0A 00 BB 00 00   ................
13E8:0050  B9 08 00 FF 37 83 C3 02-E2 F9 B8 00 4C CD 21 CC   ....7.......L.!.
13E8:0060  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00   ................
13E8:0070  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00   ................
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
发表于 2011-8-16 02:53:45 | 显示全部楼层
mov sp,10 错 。是 mov sp,16
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
发表于 2011-8-16 09:23:37 | 显示全部楼层
10需要改成10h
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
发表于 2013-1-21 21:47:05 | 显示全部楼层
MOV SP,10H后,答案也是不对的,还有循环这块MOV CX,8(之前是4)要改,但不能单步调试,否则会出错,原因是,栈设置的太小,溢出!
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

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

GMT+8, 2024-11-18 02:46

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

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