|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
本帖最后由 weixianlang 于 2011-8-11 08:20 编辑
第六章的一个疑问 麻烦小甲鱼进来解答下 谢谢
- assume cs:codesg
- codesg segment
- dw 0123h,0456h,0789h,0abch,0defh,0fedh,0cbah,0987h
- dw 0,0,0,0,0,0,0,0
- start: mov ax, cs
- mov ss, ax
- mov sp, 32
- mov bx, 0
- mov cx, 8
- s:push cs:[bx]
- add bx, 2
- loop s
-
- mov bx, 0
- mov cx, 8
- s0:pop cs:[bx]
- add bx, 2
- loop s0
- mov ax, 4c00h
- int 21h
- codesg ends
- end start
复制代码
课本为什么是 mov sp, 30 而小甲鱼的是 mov sp, 32 我来探讨下 dw 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
这里是 16个字 型数据
dw 0123h,0456h,0789h,0abch,0defh,0fedh,0cbah,0987h 这里是 8个字 型数据 进栈 出栈 都是 8个字 型数据
16个字型数据+进栈8个字型数据+出栈8个字型数据=32 那么push执行的步骤一. sp-2 二 . ss:sp
那么来看下 检测点6.1 第2题小甲鱼 答安
(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
- start:
- mov ax,cs ;cs为所填第一空
- mov ss,ax
- mov sp,24h ;此条指令为所填第二空
- mov ax,0
- mov ds,ax
- mov bx,0
- mov cx,8
- s:
- push [bx]
- pop cs:[bx] ;此条指令为所填第三空
- add bx,2
- loop s
-
- mov ax,4c00h
- int 21h
- codesg ends
- end start
复制代码
按照上面的分析dw 0,0,0,0,0,0,0,0,0,0这里是 10个字 型数据
dw 0123h,0456h,0789h,0abch,0defh,0fedh,0cbah,0987h 这里是 8个字 型数据 进栈 出栈 都是 8个字 型数据
10个字型数据+进栈8个字型数据+出栈8个字型数据=26
为什么小甲鱼这里不是 mov sp,26h 而是 mov sp,24h ;此条指令为所填第二空 求解
|
|