I am thoroughly puzzled about this, any suggestions source starting line 152
while (!UnblankSlot); SB_CR = FALSE; // stop the CCAP counter BSP1_PSTB_N = 0; // strobe the map in BSP1_PSTB_N = 1; // unblank color 1 and upload color 2 SetPCA(); UpdateDisplay(2); SetColor(d2color); while ( !UnblankSlot); SB_CR = FALSE; // stop the CCAP counter BSP1_PSTB_N = 0; // strobe the map in BSP1_PSTB_N = 1; // unblank color 2 and upload color 0 SetPCA(); UpdateDisplay(0); SetColor(d0color); while ( !UnblankSlot); SB_CR = FALSE; // stop the CCAP counter BSP1_PSTB_N = 0; // strobe the map in BSP1_PSTB_N = 1;
00C8 ?C0020: ; SOURCE LINE # 152 00C8 3000FD R JNB UnblankSlot,?C0020 00CB ?C0021: ; SOURCE LINE # 153 WHY NOTHING ; SOURCE LINE # 154 WHY NOTHING ; SOURCE LINE # 155 WHY NOTHING ; SOURCE LINE # 158 00CB 120000 R LCALL ?C0038 ; SOURCE LINE # 159 C51 COMPILER V7.00 Beta 6 AVMAIN 12/03/2002 16:33:11 PAGE 38 00CE 7F02 MOV R7,#02H 00D0 120000 E LCALL _UpdateDisplay ; SOURCE LINE # 160 00D3 AF00 R MOV R7,d2color 00D5 120000 R LCALL _SetColor 00D8 ?C0022: ; SOURCE LINE # 161 00D8 3000FD R JNB UnblankSlot,?C0022 00DB ?C0023: ; SOURCE LINE # 162 WHY NOTHING ; SOURCE LINE # 163 WHY NOTHING ; SOURCE LINE # 164 WHY NOTHING ; SOURCE LINE # 167 00DB 120000 R LCALL ?C0038 ; SOURCE LINE # 168 00DE E4 CLR A 00DF FF MOV R7,A 00E0 120000 E LCALL _UpdateDisplay ; SOURCE LINE # 169 00E3 AF00 R MOV R7,d0color 00E5 120000 R LCALL _SetColor 00E8 ?C0024: ; SOURCE LINE # 170 00E8 3000FD R JNB UnblankSlot,?C0024 00EB ?C0025: ; SOURCE LINE # 171 00EB C2C6 CLR SB_CR HERE IT IS ; SOURCE LINE # 172 00ED C290 CLR BSP1_PSTB_N HERE IT IS ; SOURCE LINE # 173 00EF D290 SETB BSP1_PSTB_N HERE IT IS ; SOURCE LINE # 176
it turns out the the compiler has "optimized" it into the SetPCA function. However, elsewhere the SetPCA is NOT preceeded by these instructions other place in source:
} // unblank color 0 and upload color 1 SetPCA();
Sounds like the "common block" optimisations again? http://www.8052.com/forum/read.phtml?id=31572
Can you show the code that is at ?C0038? I have a feeling that this code initializes the vars and calls SetPCA. Jon
How sneaky/elegant. The resulting code has a "double entry subroutine" one entry has the 3 "missing" instructions in front the other is SetPCA as is. The problem here is that the source in the ICE of course does not show this and a first look at the assembly code show them missing. Running from DOS batchfiles is there a way to make the DEBUG VERSION of the code exactly match what the C source states? Erik
"The problem here is that the source in the ICE of course does not show this" Yes - this is always a problem with optimising compilers! That's why things like MSVC and Borland C++ Builder let you specify a 'DEBUG' or 'RELEASE' build. From time to time, people ask here how to do the same in uVision - but its Project management isn't really quite up to it. You might find it easier with your batch files? "is there a way to make the DEBUG VERSION of the code exactly match what the C source states?" Avoid the OBJECTADVANCED option? Use OPTIMISE(0)?
There is a knowledgebase article that addresses this problem: http://www.keil.com/support/docs/2467.htm In a nutshell, you can create a project with 2 targets: 1 for debugging and 1 for production. (I prefer to debug using the production code.) In the Debugging target, set the optimizer level to 3. That causes the compiler and linker to perform no optimizations that move code around. In the Production target, set the optimizer level to whatever you want. Note that code may be moved around by the higher level optimizations. Jon
what is the compiler and linker DOS commandline options for no optimization? Erik
"In a nutshell, you can create a project with 2 targets" The trouble is, they are totally independent Targets - there is no way to maintain options which need to be common to both. :-( There needs to be (at least?) one more level in the Project Hierarchy.
OPTIMIZE(0)
OPTIMIZE(0) linker and/or compiler ? Erik
Compiler Only. Jon