写点什么

8086 汇编基础 call word ptr 示例

  • 2023-10-16
    北京
  • 本文字数:592 字

    阅读完需:约 2 分钟

    IDE : Masm for Windows 集成实验环境 2015

      OS : Windows 10 x64

typesetting : Markdown

       blog : www.infoq.cn/u/qingkongwanli


code

datas segment    ;数据段代码datas ends
stacks segment ;堆栈段代码
stacks ends
codes segment assume cs:codes,ds:datas,ss:stacksstart: mov ax,datas mov ds,ax
;代码段代码 mov ax,4321h mov ds:[0],ax
call word ptr ds:[0] ;push的ip地址是 mov ax,1111h的
mov ax,1111h ;不执行的指令 pop ax
mov ah,4ch int 21hcodes ends end start
复制代码


debug




more knowledge

  • call word ptr ds:[0],执行这个命令的过程:

  • 将 call word ptr ds:[0]读入指令缓冲器

  • ip 自加, cs 不动

  • 执行指令缓冲器中的命令 call

  • push ip

  • jmp word ptr ds:[0] 改变了 IP 的值

  • jmp word ptr ds:[0] 相当于 mov ip,ds:[0]。虽然不能这么写,但是可以这样解释。用已学的解释未学的!


reference

  • [1] 王爽. 汇编语言.第 3 版[M]. 清华大学出版社, 2013.


resource


感谢帮助 万里无云万里天 的人们。

不同芯片的汇编指令存在差异,嵌入式和信息安全领域中会见到汇编语言。

汇编/C/C++等可以进行硬件编程,要结合社会需求与个人爱好有选择地进行学习。眼界需要开阔。

该博文仅可用于测试与参考。


发布于: 13 分钟前阅读数: 6
用户头像

分享自学历程中的经验心得。 2021-05-29 加入

微信公众号:悟为生心

评论

发布
暂无评论
8086汇编基础 call word ptr示例_汇编语言_万里无云万里天_InfoQ写作社区