Your reported behaviour doesn't really make sense. add rsp, 28h works with or without this!!! sub rsp, 28h works with or without this!!! However if I use this code it works as expected: PUBLIC Rora_I_A Op 46 - Rotate Right through Carry A reg Pushf this causes jump to end of program ?Ĭall SaveFlagsCmb NZ from the add and CF saved in dx add 0 to result to trigger Zero and Sign/Neg flags Rotate Right the byte and save the FLAGS PUBLIC Rora_I_A Op 46 - Rotate Right through Carry A reg The code represents an emulated 6809 CPU Rora (Rotate Right Register A). SaveFlagsCmb is an assembly function but could easily be a macro. So I tried removing this from both routines but it made no difference. However I noticed that this is only necessary when the assembly code calls a C function. In the routines I usually setup and clean up the stack with : Since my work around works as expected I would like to know why using the pushf instruction appears to be (I assume) corrupting the stack. This code is called from a C function which is several call levels deep and the pushf causes program execution to revert back several levels through the stack and completely exit the program. I think my real problem is I don't completely understand the stack frame mechanism so I am looking to understand why the following code causes the program execution to resume at the end of the application.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |