-void pic16_dump_cblock(FILE *of)
-{
- int start=-1;
- int addr=0;
- int bank_base;
-
- //pic16_dump_map(); /* display the register map */
-
- if (pic->maxRAMaddress < 0) {
- fprintf(stderr, "missing \"#pragma maxram\" setting\n");
- return;
- }
-
- do {
-
- if(pic16_finalMapping[addr].reg && !pic16_finalMapping[addr].reg->isEmitted
- && pic16_finalMapping[addr].reg->wasUsed) {
-
- if(start<0)
- start = addr;
- } else {
- if(start>=0) {
-
- /* clear the lower 7-bits of the start address of the first
- * variable declared in this bank. The upper bits for the mid
- * range pics are the bank select bits.
- */
-
- bank_base = start & 0xfff8;
-
- /* The bank number printed in the cblock comment tacitly
- * assumes that the first register in the contiguous group
- * of registers represents the bank for the whole group */
-
- if ((pic16_finalMapping[start].bank == 0 && start <= 0x7f) ||
- pic16_finalMapping[start].isSFR)
- fprintf(of," cblock 0X%04X\t; Access Bank\n",start);
- else
- fprintf(of," cblock 0X%04X\t; Bank %d\n",start,pic16_finalMapping[start].bank);
-
- for( ; start < addr; start++) {
- if((pic16_finalMapping[start].reg) && !pic16_finalMapping[start].reg->isEmitted ) {
- fprintf(of,"\t%s",pic16_finalMapping[start].reg->name);
-
- /* If this register is aliased in multiple banks, then
- * mangle the variable name with the alias address: */
- if(pic16_finalMapping[start].alias & start)
- fprintf(of,"_%x",bank_base);
-
- if(pic16_finalMapping[start].instance)
- fprintf(of,"_%d",pic16_finalMapping[start].instance);
-
-
- fputc('\n',of);