I am upgrading an HC11 mixed C and assembly application to an HC12 or HCS12 processor. Do I need to change my assembly code?
HC11 assembly source code is compatible with the HC12 Assembly source so the majority of your code can be reused. There are a couple of areas where you need to be careful. One is hardware drivers because the peripherals are a little different and the other is the argument passing conventions between C and assembly code for longs and single precision floats. All other calling conventions are the same between the HC11 and the HC12. This change was made because the HC12 addressing modes allow a much more efficient method for passing longs than the HC11. If your code passes a long or a float (32 bit) as the first argument (or return value) between a C routine and an assembly routine you will need to rewrite the interface to the assembly routine to use the HC12 convention which is described in the user’s manual in section "Interfacing C to Assembly Language". The HC12 compiler uses the X and Y pair when a 32 bit value is passed as the first argument or returned and the HC11 uses the stack. The description above assumes the application was written for the Cosmic HC11 V4+ compiler and assembler.