| ??? 08/18/05 09:16 Read: times |
#99634 - gurus don't subtract constants Responding to: ???'s previous message |
When you get a little bit more familiar with the instruction set, you can try some minor optimisation:
To avoid the need for clearing carry before subb, when subtracting constants, you can add the negative of it instead - just remember, that the meaning of carry will be the opposite: ; A - original code ADD A,#-20h JNC PRN_CHAR_END ; code is below 0x20 so non-printable (Btw. AVRs by design don't have add a constant instruction - so one has to use subtract instead... (or a "helper" register).) You can also completely avoid manipulation with the "pointer" simply by offsetting the table address when loading into dptr; but if you are not absolutely sure that the input value will be above 20h, there is little gained from this as you need to check it anyway. Jan Waclawek |
| Topic | Author | Date |
| Code optimization suggestion? | 01/01/70 00:00 | |
| Table | 01/01/70 00:00 | |
| Table? | 01/01/70 00:00 | |
| Another table ... | 01/01/70 00:00 | |
| CJNE | 01/01/70 00:00 | |
| Everybody is saying to use a table | 01/01/70 00:00 | |
| My confsion | 01/01/70 00:00 | |
| two tables | 01/01/70 00:00 | |
| Tables | 01/01/70 00:00 | |
| sure | 01/01/70 00:00 | |
| gurus don't subtract constants | 01/01/70 00:00 | |
| 16 bit table | 01/01/70 00:00 | |
| bit table | 01/01/70 00:00 | |
Table indexing | 01/01/70 00:00 |



