Warning
You're browsing the old v2.x documentation. This version is no longer maintained. Click here to go the v3.x documentation.
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionLast revisionBoth sides next revision | ||
extensions_tutorial [2019/12/12 11:10] – [Referencing XC=BASIC symbols in assembly language] neils | extensions_tutorial [2019/12/12 20:01] – [Referencing XC=BASIC symbols in assembly language] neils | ||
---|---|---|---|
Line 70: | Line 70: | ||
| | ||
fun joy_firepressed!(port!) | fun joy_firepressed!(port!) | ||
- | | + | |
asm " | asm " | ||
- | | + | ; This is how to refer to a function' |
+ | lda {self}.port | ||
+ | ; Port #2 becomes 0, Port #1 remains 1 | ||
+ | and | ||
+ | tax | ||
+ | ; This is how to refer to a global constant | ||
+ | lda.wx | ||
+ | eor # | ||
+ | and # | ||
+ | lsr | ||
+ | lsr | ||
+ | lsr | ||
+ | lsr | ||
+ | ; A now holds the return value of our function | ||
+ | ; Write it to the variable ' | ||
+ | sta {self}.result | ||
" | " | ||
+ | return result! | ||
endfun | endfun |