APPENDIX
BENCHMARK: Character Search
PROCESSOR: Motorola 6809
|
|
| ;REGISTER | USAGE: |
|
|
| ||
|
|
|
|
| A - | ACCUMULATOR |
|
| |
|
|
|
|
| B - | COUNT |
|
|
|
|
|
|
|
| X - | TABLE POINTER |
|
| |
Bytes | Cycles |
|
|
|
|
|
|
|
|
3 | 3 | #PTR |
| ;Initialize Table | Pointer | ||||
2 | 2 | LOA | #CHAR |
| ;Search character |
| |||
2 | 2 | LOB | #40 |
|
| ;Initialize count |
| ||
2 | 6 AGAIN | CMPA | ,X+ |
|
| ; Compare , | autoincrement | ||
2 | 3 | BEQ | PASTPTR | ;Jump if found |
| ||||
1 | 2 | OECB |
|
|
| ; Decrement | count |
| |
2 | 3 | BNE | AGAIN |
| ;00 | again | unless B=O | ||
3 | 3 | LOX | #1 |
|
| ;Not | found: X will | return 0 | |
2 | 5 PASTPTR | LEAX | - 1, X |
| ;Adj ust X |
|
| ||
|
| 19 | bytes | of | code |
|
|
| |
|
| 9 lines | of | code |
|
|
|
36 | AFN 01532A |