How do I perform a long jump to a numerical address from my C code? I'm pretty sure I have to do this with inline assembly - however that seems complicated for C51. I figured in C I could do this:
typedef void (*jmpPtr)(void); jmpPtr jmp; ... unsigned int address = 0x4000U; jmp = (jmpPtr) address; (*jmp)();
Most Keil help suggests that you can't do inline assembly in C code (without jumping through a few hoops). However I found this obscure link, and it turns out it is easy! http://www.keil.com/support/docs/754.htm I'll have to go back and look to see if #pragma asm has been in the C51 user's manual this whole time.
It certainly has - page 12! What gave you the impression it couldn't be done? It's no more difficult than many compilers which support inline Assembler. The catch is that you also need to specify the SRC directive to make the Compiler emit assembler source, and then pass that to the assembler to generate the object! (in uVision2, just check the 'Generate Assembler SRC File' and 'Assemble SRC File' options in the file properties for the 'C' source)