在 8086 中将标志值存储在变量中 - 汇编语言
Storing Flag Values in Variables in 8086 - Assembly Language
我想问一下有没有明确和简单的方法来存储标志的值,例如(进位标志,辅助标志,奇偶校验标志,零标志,溢出标志,签名标志 等)在变量中,例如;
.data
carry_flag db 0
auxiliary_flag db 0
zero_flag db 0
我研究了很多,但找不到在 8086 处理器的变量中“存储”标志值的方法。我们当然可以使用任何调试器查看标志,例如 AFD Debugger 但是如果我们想将它们存储在 运行 时间并且在程序结束时将它们显示给用户。
请提出一种简单的方法,将标志寄存器中所有此类标志的值存储到 8086 汇编语言 - MASM 中的变量中。
提前致谢!
I wanted to ask that is there any explicit and easy way to store the values of flags in variables
最简单的方法是使用循环。接下来的代码片段将在字节大小的变量中存储 8086 上可用的 9 个标志。如果标志为 OFF,则为 0,如果标志为 ON,则为 1。
允许 3 个未使用的数据字节(更简单)
.data
CF db 0
db 0
PF db 0
db 0
AF db 0
db 0
ZF db 0
SF db 0
TF db 0
IF db 0
DF db 0
OF db 0
...
pushf
pop dx
mov di, offset CF
mov cx, 12
cld
More:
shr dx, 1
mov al, 0
rcl al, 1
stosb
dec cx
jnz More
没有未使用的数据字节(适合连续显示)
.data
CF db 0
PF db 0
AF db 0
ZF db 0
SF db 0
TF db 0
IF db 0
DF db 0
OF db 0
...
pushf
pop dx
mov di, offset CF
mov cx, 12
mov bx, 0FD5h ; Mask of defined flags
cld
More:
shr dx, 1
mov al, 0
rcl al, 1
shr bx, 1
jnc Skip ; Bit does not correspond to a defined flag
stosb
Skip:
dec cx
jnz More
我想问一下有没有明确和简单的方法来存储标志的值,例如(进位标志,辅助标志,奇偶校验标志,零标志,溢出标志,签名标志 等)在变量中,例如;
.data
carry_flag db 0
auxiliary_flag db 0
zero_flag db 0
我研究了很多,但找不到在 8086 处理器的变量中“存储”标志值的方法。我们当然可以使用任何调试器查看标志,例如 AFD Debugger 但是如果我们想将它们存储在 运行 时间并且在程序结束时将它们显示给用户。
请提出一种简单的方法,将标志寄存器中所有此类标志的值存储到 8086 汇编语言 - MASM 中的变量中。
提前致谢!
I wanted to ask that is there any explicit and easy way to store the values of flags in variables
最简单的方法是使用循环。接下来的代码片段将在字节大小的变量中存储 8086 上可用的 9 个标志。如果标志为 OFF,则为 0,如果标志为 ON,则为 1。
允许 3 个未使用的数据字节(更简单)
.data
CF db 0
db 0
PF db 0
db 0
AF db 0
db 0
ZF db 0
SF db 0
TF db 0
IF db 0
DF db 0
OF db 0
...
pushf
pop dx
mov di, offset CF
mov cx, 12
cld
More:
shr dx, 1
mov al, 0
rcl al, 1
stosb
dec cx
jnz More
没有未使用的数据字节(适合连续显示)
.data
CF db 0
PF db 0
AF db 0
ZF db 0
SF db 0
TF db 0
IF db 0
DF db 0
OF db 0
...
pushf
pop dx
mov di, offset CF
mov cx, 12
mov bx, 0FD5h ; Mask of defined flags
cld
More:
shr dx, 1
mov al, 0
rcl al, 1
shr bx, 1
jnc Skip ; Bit does not correspond to a defined flag
stosb
Skip:
dec cx
jnz More