CPU registers, structs and function pointers

Started by
9 comments, last by Rickmeister 19 years, 10 months ago
quote:Original post by Monder
Though if you do it temp_ie_cant_thinkof_name's way then you're basically doing parameter passing anyway so you may as well do it properly without all the asm stuff.


Came to my mind also.. The goal was not to clobber my code like temp_ie_cant_thinkof_name suggested, but to have a small chunk of inline assembly at the beginning of the accessor functions to enable the instance.funcptr(arg) syntax instead of using instance.funcptr(instance,arg), but my assembly skills ain't that great, as is my knowledge of how the cpu really does work. But, one good thing has come out of all this crap - now I know much better how the compiler uses the registers and the stack

This idea was a complete shot in the dark, as I only happend to notice that Lcc used the EDI register to store the pointer to the instance of the struct when accessing it's variables. Just had to see if there was some other technique that I could use as it was a bit hackish and probably totaly unsafe.

God Speed

[edit] I wasn't refering to the above post by temp_ie_cant_thinkof_name.

"For every complex problem there is an answer that is clear, simple, and wrong." H L Mencken

[edited by - Rickmeister on June 2, 2004 3:50:18 PM]

This topic is closed to new replies.

Advertisement