马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
- 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
-
- 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
复制代码 执行几次循环后0cbaH,0987H 会变成cs 地址cs:0000
本帖最后由 jackz007 于 2020-3-28 22:41 编辑
堆栈的栈顶被安排在代码区,堆栈的每一次活动都会直接破坏代码指令,必须把二者隔开。
- assume cs:codesg , ds:codesg
- stack segment stack
- dw 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
- stack ends
- codesg segment
- dw 0123H,0456H,0789H,0abcH,0defH,0fedH,0cbaH,0987H
- start:
- mov ax,codesg
- mov ds,ax
- xor bx,bx
- mov cx,8
- s:
- push [bx]
- ADD bx,2
- loop s
-
- xor bx,bx
- mov cx,8
- s0:
- pop [bx]
- add bx,2
- loop s0
-
- mov ax,4c00H
- int 21H
- codesg ends
- end start
复制代码
|