| ??? 04/19/07 23:41 Read: times |
#137576 - Optimisation Responding to: ???'s previous message |
Rule#1 - get the code working first, then look at optimising. Looking at your code - there is no evidence of a ring buffer - where are the head and tail pointers? With a circular (ring) buffer, you don't need flags - you compare the head and tail pointers to see if the buffer is empty,has data avail or full. Assign symbolic names to ram and bits - makes your code easier to read. What is the problem in utilising internal ram? Use R0 or R1 instead of DPTR. push PSW push ACC push bank0_R0 mov r0,head_ptr mov a,SBUF clr RI mov @r0,a inc r0 ; ; add in test for end of buffer ; mov head_ptr,r0 pop bank0_R0 pop ACC pop PSW reti |
| Topic | Author | Date |
| if I could crunch my code... | 01/01/70 00:00 | |
| Optimisation | 01/01/70 00:00 | |
| the original 8051 is the problem... | 01/01/70 00:00 | |
| Duhh! | 01/01/70 00:00 | |
| again, I want to "crunch my code" | 01/01/70 00:00 | |
| starg with something that works. | 01/01/70 00:00 | |
| Did You Look at Movx @R0 ? | 01/01/70 00:00 | |
| Thanks (after I tried it LOL) | 01/01/70 00:00 | |
| data sheet | 01/01/70 00:00 | |
Hidden P2 Register? | 01/01/70 00:00 | |
| Simple,but no simpler | 01/01/70 00:00 | |
| Problem? | 01/01/70 00:00 | |
| save a few bytes by using JBC | 01/01/70 00:00 | |
| an alternative | 01/01/70 00:00 | |
| WRONG | 01/01/70 00:00 |



