We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
/*hi all.. who can tell me my code right or have any bug? and anyone have better than the function ,but no assembler.*/ main() { /*reset function*/ unsigned char code rst[]={0xe4,0xc0,0xe0,0xc0,0xe0,0x32}; // reset code. (*((void (*)())(rst)))(); // call and run the reset code. } jane
I understand the underlying method. But the question remains: why would you want to do this?? Your method of embedding machine code is fine as long as the byte array is a const and stored in code space. The more accepted method would be to write an assembler file and call that from the 'c' code. At least you could read the instructions rather than a table of bytes that just happens to be machine code.
thanks russell... i know your means.and u method is better than me... but i feel my method is easily,look like the assembler. because i using assembler ever. in the end ,i'm sorry to my poor english and in trouble u. sincerely jane:)