The addres which I give the write function is UWORD and its given as it shows (0x4000 or 0xC000), should there be a some kind of conversion? I used some kind of converter, which is used at Paged addres flash, but it screwed the writing addres big time, so after conversion it pointed at 0x0000.
I dont't know what you mean with post compilable routines, but compiler command line arguments are:
-CPUHCS12X -D_FAR_DATA_NO_FLOAT__ -Lasm=%n.lst -Mb
defines:
#define UBYTE unsigned char
#define SBYTE char
#define UWORD unsigned int
#define SWORD int
#define UDWORD unsigned long int
#define SDWORD long int
wait 4 flash:
static UBYTE WaitForFlash[]=
{
0x1E, 0x01, 0x05, 0x20, 0x05, // BRSET _FSTAT,#32,*+10
0x1F, 0x01, 0x05, 0x10, 0x03, // BRCLR _FSTAT,#16,*+8
0xC6, 0x09, // LDAB #9
0x3D, // RTS
0x1F, 0x01, 0x05, 0x40, 0xFB, // BRCLR _FSTAT,#64,*+0
0x3D // RTS
};