Parameters are often passed fixed memory locations
Programming the 65816
0001 |
|
KEEP |
|
||
---|---|---|---|---|---|
0002 | |||||
0003 |
|
||||
0004 |
|
||||
0005 | |||||
0006 | |||||
0007 |
|
||||
SEP |
|
||||
0008 | |||||
0009 | STRING1 | ||||
0010 |
|
||||
REP |
|
||||
0012 | |||||
0013 |
|
pass the address of STRING1 to PRSTRNG | |||
LDX | #STRING1 | ||||
0014 |
|
||||
0015 | JSR | ||||
0016 | |||||
LDX | #STRING2 | pass the address of STRING2 to PRSTRNG | |||
0017 |
|
||||
0018 |
|
JSR | |||
0019 | |||||
0020 |
|
||||
0021 |
|
||||
0022 | |||||
0023 |
|
||||
|
|||||
0024 | 0015 54686973 | ||||
0025 | 0028 54686973 | STRING2 | |||
0026 |
|
0027 | 12 | 239 | |||||
---|---|---|---|---|---|---|---|
0028 |
|
||||||
0029 |
|
||||||
0030 | |||||||
PRSTRNG |
|
||||||
0031 | |||||||
0032 |
|
||||||
0033 | TOP | LDA | get char at index position in string | ||||
0034 | BEQ |
|
|||||
0035 |
|
JSR | |||||
0036 | INX | ||||||
0037 |
|
BRA |
|
||||
0038 | DONE | ||||||
0039 |
|
||||||
0040 |
|
||||||
0041 | 1 | ||||||
0042 | |||||||
0043 | |||||||
1 |
|
||||||
|
|||||||
0044 | |||||||
0045 | |||||||
COUT | |||||||
0046 | ECOUT | GEQU |
|
|
|||
0047 | PHA | ||||||
0048 | |||||||
0049 |
|
|
|||||
0050 | PHP | ||||||
0051 | SEC | ||||||
0052 |
|
|
|||||
0053 | JSR | ||||||
0054 |
|
||||||
0055 |
|
XCE | |||||
0056 | PLP | ||||||
0057 | PLY |
|
|||||
0058 |
|
||||||
PLX | |||||||
0059 | |||||||
0060 |
|
||||||
0061 |
|