何时会code。在数据段在此code执行? [英] When Will the Code Under DATA SEGMENT execute in this code?

查看:178
本文介绍了何时会code。在数据段在此code执行?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是汇编编程的初学者...
我在谷歌冲浪了很多。有很多的信息,但我还是不明白以下code。我将不胜感激,如果有人可以解释

I am a beginner of Assembly Programming... I surfed a lot in google. There is a lot of information, but I still do not understand the following code. I would be grateful if someone could explain

MOV AX,DATA

MOV AX,DATA

我也搞不懂,当code,它是数据段present将在此计划执行。

I also don't understand when the code that is present in data segment would be executed in this program.

ASSUME CS:CODE,DS:DATA

CODE SEGMENT
 MOV AX,@DATA
 mov DS,AX
 ...
 ...
CODE ENDS


DATA SEGMENT
   ...
   ...
   ... //SOMECODE
DATA ENDS 

此外,可有人向我解释一下下面的说明吗?..

Also, can someone explain to me what the following instructions do?..

MOV AH,?? H(??可充满09,4c等)。

MOV DS,AX

MOV ES,AX

推荐答案

警告:我没写过8086装配在我的生活,但是这是我做的这

Warning: I've never written 8086 assembly in my life but this is what I make of it.

MOV AX,@ DATA 是获取运行code的第一道防线。我相信@DATA是保持在内存中的数据段住的位置的值的变量。它移动@DATA的存储器位置到AX寄存器(16位寄存器)。这里有一点要注意的是在字数据前面的@。我相信这是因为@DATA是在链接过程中评估,它将被它的实际值替换。请注意如何其他例子没有@在前面,因为他们指的是一个实际的内存位置开始。

MOV AX,@DATA is the first line of code that gets run. I believe @DATA is a variable that holds the value of the location in memory where the data segment lives. It moves the memory location of @DATA into the AX register (16 bit register). One thing to note here is the @ in front of the word DATA. I believe this is because @DATA is evaluated during the linking process and it will be replaced by its actual value. Notice how the other examples to not have the @ in front because they are referring to an actual memory location to begin with.

MOV DS,AX 然后将设置存储位置的变量 DS 这是一个标准的变量(或注册在这种情况下)为8086汇编。它应该始终指向您想(如果你熟悉C ++术语的堆),以保持价值存储的位置。

MOV DS,AX will then set that memory location as the variable DS which is a standard variable (or register in this case) for 8086 assembly. It should always point to the location of your storage where you want to keep values (the heap if you're familiar with C++ terminology).

在AX寄存器是一个简单的临时占位符,您可以用值加载并执行对执行命令。

The AX register is simply a temporarily place holder that you can load with values and perform execute commands against.

动啊,14 H 首先,对AH指AX寄存器的高的一面。这样做的兄弟会是AL它指的是AX寄存器的低的一面。当你想对8位而不是16位执行命令时使用。这样做的第二部分,26 H为你指的是你要在AH寄存器来存储值。在年底的H表示十六进制。所以,如果你有00H,这将意味着零(十六进制)。如果你把FFH这将是一样的十进制数系统255

MOVE AH, ??H First of all, the AH refers to the "high" side of the AX register. The brother of this would be AL which refers to the "low" side of the AX register. This is used when you want to perform commands against 8 bits instead of 16 bits. The second part of this, the ??H as you refer to it is the value you want to store in the AH register. The H at the end means "hexadecimal". So if you have 00H that would mean zero (in hex). If you put in FFH that would be the same as 255 in decimal number system.

返回到您最初的问题:什么时候会code。在数据段在此code执行? - 我相信,当数据段将被执行你的要求。这通常是因为它应该存储数据(变量)在你的code段的使用不应该被执行。在某些操作系统就可以解决这个问题,我相信,只是跳转或转移至code那部分,并把它作为一个常规的code段。这有时是如何栈溢出,堆溢出,(黑客),等等,所有的工作。

Back to your initial question "When Will the Code Under DATA SEGMENT execute in this code?" -- I believe you're asking when the DATA SEGMENT will be executed. This normally should not be executed because it's supposed to store data (variables) for use in your CODE SEGMENT. On some operating systems you can get around this I believe and simply JUMP or BRANCH to that section of code and treat it as a regular CODE SEGMENT. This is sometimes how stack overflows, heap overflows, (hacks), etc, all work.

这篇关于何时会code。在数据段在此code执行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆