|
||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||
|
|
Listing 2-There will be interesting surprises in the C code operation if the 21K circular buffer hardware is left activated. C code segment int values[10]; int sum = 0; int *pt = values; for (count = 0; count < 3; count++) sum = sum +*pt++; 21K code segment .segment/dm seg_dmda; .var VALUES[10]; .endseg; .segment/pm seg_pmco; // Some where else in the code the 21K // circular buffer hardware gets left activated B4 = VALUES; L4 = 2; // Same code as before // Clear the sum variable R0 = 0; // Setup the pointer to the array I4 = VALUES; // Set up address modify constant M4 = 1; // Calculate the sum R1 = dm(I4, M4); // Fetch R0 = R0 + R1; // and add R1 = dm(I4, M4); // Fetch R0 = R0 + R1; // and add // I4 is incremented, and // then adjusted by the // circular buffer hardware // to point back to VALUES[0] R1 = dm(I4, M4); // Fetch R0 = R0 + R1; // and add // I4 pointing to VALUES[1]
|
|||||||||||||||||||||||||||||||||
|
Copyright © 2003 ChipCenter-QuestLink About ChipCenter-Questlink |
||||||||||||||||||||||||||||||||||