This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

IAP calls to read program boot vector (Phillips P89C66x chip)

I'm using a Philips P89C662 that provides In-system Application Programming (IAP) with have an entry address at 0xFF00.

I am trying to read proram boot vector information. I an not sure how to refer to registers R0 & R1. R0 register is set to FOSC and R1 is set to 06 for boot vector. All other registers are defined in the reg66x.h file. Registers AUXR1, DPL, DPH are alredy defined. Only R1 & R2 are not defined.

typedef void (*pgm_mtp_ptr)(int);
pgm_mtp_ptr iap_call = (pgm_mtp_ptr) 0xFFF0;

unsigned char vec;

AUXR1= 0x20; /* set the ENBOOT bit */
R0 = 18; /* FOSC */
R1 = 0x7; /* Read Misc Function */
DPH = 0x0;
DPL = 0x2; /* specify boot vector */
vec = 0; /* init vec to zero */
vec = iap_call(); /* call PGM_MTP @0xfff0 */

I am getting error C2002: 'R0' and 'R1' : as undefined variables.

sfr R0 = 0x0;
sfr R1 = 0x1;
Cannot define using sfr as 0 & 1 as compiler complains about invalid base addresss.

Can some one point to me as to how to set the various IAP commands in Register R1 ?????

Thanks, Venkat

Parents
  • It is an absolute fact that, in order to make 'canned routines' work across various platforms the interface must be in assembler. e.g. were I to write some routines and supply them in object only, I doubt that they would work called from C regardless of e.g Keil with or without NOREG , Raisonance, GNU or IAR.

    Thus 'converting a foreign routine inteface to C' is a futile excersise.

    Erik

Reply
  • It is an absolute fact that, in order to make 'canned routines' work across various platforms the interface must be in assembler. e.g. were I to write some routines and supply them in object only, I doubt that they would work called from C regardless of e.g Keil with or without NOREG , Raisonance, GNU or IAR.

    Thus 'converting a foreign routine inteface to C' is a futile excersise.

    Erik

Children
No data