| |

VerySource

 Forgot password?
 Register
Search
View: 1974|Reply: 8

A small question about Pushf and Popf

[Copy link]

1

Threads

3

Posts

4.00

Credits

Newbie

Rank: 1

Credits
4.00

 China

Post time: 2020-2-6 07:00:01
| Show all posts |Read mode
Dear masters, Little D has begun to compile. I have encountered a small problem. I can't figure it out. I hope you can take the time to give me pointers. Thank you ~~
Little D studied Wang Shuang's "Assembly Language". He learned the flag register and encountered a small problem.
The flag register has several flag bits such as cf, pf, zf, sf, of, and df.
Pushf pushes the value of the flag register onto the stack
Popf is popping values
The main thing D didn't understand was, did Pushf push all the flag values ​​into the stack?
I have used debug to monitor that sp is fec before pushing the stack, and spee is fee after pushing the stack. Here we calculate the space of 2 bytes, and put the values ​​of cf, pf, zf, sf, of, and df. Obviously Isn't it enough, isn't pushf pushed all the flag values ​​into the stack, or is it just the stack part?
I hope that the master who knows can answer me, thank you very much! Thank you!
Reply

Use magic Report

0

Threads

17

Posts

16.00

Credits

Newbie

Rank: 1

Credits
16.00

 China

Post time: 2020-3-24 22:15:02
| Show all posts
Why aren't these values ​​enough? There is only one digit for each sign.
Reply

Use magic Report

1

Threads

3

Posts

4.00

Credits

Newbie

Rank: 1

Credits
4.00

 China

 Author| Post time: 2020-3-25 17:45:01
| Show all posts
Seniors back upstairs ...
How do I put in the first place? Can you elaborate?
If it is 1, is it pushed directly into the stack instead of 01?
Just monitored the value just now ..
d 1802: ffec ffee
1802: ffe0 80 32 00
Why is there such a value ... I can't figure it out ...
Even if all the flag values ​​are put in .. There is no such strange number ...?
Reply

Use magic Report

0

Threads

3

Posts

4.00

Credits

Newbie

Rank: 1

Credits
4.00

 China

Post time: 2020-4-18 02:00:01
| Show all posts
What pushf performs is to push the entire flag (the value of the flag register onto the stack)
The flag register is also a 16-bit register, how can it not be enough? The stack operations are all word operations, with two bytes just pressing 16 bits. The landlord misunderstood the cf, zf, of, and other flag bits. These flag bits are actually contained in a 16-bit register, and each flag bit occupies only one bit.
Reply

Use magic Report

0

Threads

17

Posts

16.00

Credits

Newbie

Rank: 1

Credits
16.00

 China

Post time: 2020-5-26 16:45:04
| Show all posts
The upstairs is pretty good, the flag is also a 16-bit register, and each flag occupies one of them.
Reply

Use magic Report

0

Threads

3

Posts

3.00

Credits

Newbie

Rank: 1

Credits
3.00

 China

Post time: 2020-7-4 15:00:02
| Show all posts
nod The landlord probably got into a dead end. The flag register is either 16-bit or 32-bit, and pushf and popf work normally.
Otherwise, how to say "sign bit", because a sign only occupies 1 bit
Reply

Use magic Report

1

Threads

3

Posts

4.00

Credits

Newbie

Rank: 1

Credits
4.00

 China

 Author| Post time: 2020-7-28 19:30:02
| Show all posts
Thank you masters~
Reply

Use magic Report

0

Threads

1

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2020-8-31 00:45:01
| Show all posts
Doesn't the stack grow from top to bottom? Why does sp grow bigger after pushf
Reply

Use magic Report

0

Threads

1

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2020-9-3 20:30:01
| Show all posts
Yes indeed. Pushf sp=sp-2, why has it increased?
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2023|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list