NV UP EI PL NZ NA PO NC的含义(转)

原帖http://answers.yahoo.com/question/index?qid=20061110202234AATMzc7

The types of flags within the simple 8086 CPU are as follows, with their abbreviation in parentheses:

Overflow (OF)
Direction (DF)
Interrupt Enable (IF)
Sign (SF)
Zero (ZF)
Auxillary Carry (AF)
Parity (PF)
Carry (CF)

The functions of the flags are as follows ("cleared" means a value of 0 while "set" means a value of 1):

OF - set if the result of a signed arithmetic or logic operation is too large of a positive number or too small of a negative number to fit into the CPU's registers..

DF - set if the programmer wants to decrement the index registers (SI and DI) during string manipulation instructions. Cleared to 0 to increment.

IF - set to allow external devices to interrupt the CPU for service requests

SF - set if the most significant bit of an arithmetic/logic operation is set. Usually interpreted as a negative number when set.

ZF - set if the result of an arithmetic/logic operation is equal to 0.

AF - set if there was a carry from or borrow to bits 0-3 in the AL register.

PF - set if the number of 1s (or parity) in the low-order byte is even.

CF - set if there was a carry from or borrow to the most significant bit during last result calculation.

Now we know what the flags do, but why do their abbreviations not match the ones in your question? Because the ones in your question refer to STATES of these flags, not the flags themselves per se.

NV - means "no overflow", or the OF = 0

UP - means that string manipulation instructions will cause the index registers to increment, or DI = 0

EI - means interrupts are enabled, or IF = 1

PL - means a number is positive, or the SF = 0

NZ - means a number is not equal to 0, or the ZF = 0

NA - means no bits were carried or borrowed from bits 0-3 of the AL regiater, or the AF = 0

PO - means the number of ones is odd, or PF = 0

NC - means no bits were carried or borrowed from the most significant bit, or CF = 0

In conclusion, the 80x86 family has many more flags that do things such as processor control, program access control, power management, etc. Without these simple flags, computers would be utterly useless, not knowing how to compare and test binary data.

在使用debug工具将汇编指令`mov ax, 4E20H`写入内存之前,我们需要先了解`debug`是DOS操作系统下的一个程序,它可以用来检查、修改、执行和调试可执行文件或内存中的程序。`mov ax, 4E20H`是一个简单的汇编指令,表示将十六进制数4E20赋值给AX寄存器。 要将这条指令写入内存,可以按照以下步骤操作: 1. 打开DOS命令行窗口。 2. 输入`debug`命令启动debug程序。 3. 使用`-`(减号)进入汇编模式。 4. 输入`A`(表示汇编)后按回车,然后输入想要写入的地址。通常可以使用`CS:100`作为起始地址,CS是代码段寄存器,100是我们假设的一个偏移地址。 5. 按照提示输入指令`mov ax, 4E20H`。 6. 输入`G`(表示Go执行)来执行该条指令,或者使用其他debug命令来检查或继续调试。 例如: ``` C:\>debug -d 100 100: 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 ................ -e 100 100: mov ax, 4E20 -r AX=0000 BX=0000 CX=0000 DX=0000 SP=FFEE BP=0000 SI=0000 DI=0000 DS=1AA0 ES=1AA0 SS=1AA0 CS=1AA0 IP=0100 NV UP EI PL NZ NA PO NC 1AA0:0100 B8204E MOV AX,4E20 -g 100 B8204E 4E20 mov ax,4E20 AX=4E20 BX=0000 CX=0000 DX=0000 SP=FFEE BP=0000 SI=0000 DI=0000 DS=1AA0 ES=1AA0 SS=1AA0 CS=1AA0 IP=0103 NV UP EI PL NZ NA PO NC 1AA0:0103 0000 ADD [BX+SI],AL ``` 以上步骤展示了如何在debug环境下将`mov ax, 4E20H`这条指令写入内存地址100处,并执行它。注意,这里的地址和寄存器值可能根据您的具体环境有所不同。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值