mirror of
https://github.com/jackyzha0/quartz.git
synced 2025-12-26 22:34:06 -06:00
vault backup: 2022-08-01 10:10:54
This commit is contained in:
parent
110ed00eb9
commit
6e188762f5
@ -7,10 +7,40 @@ tags:
|
|||||||
|
|
||||||
|
|
||||||
# Routines
|
# Routines
|
||||||
|
All variables are global so there is no params or local vars.
|
||||||
|
|
||||||
|
There are three way to "Branch" to a subroutine.
|
||||||
|
- lbsr
|
||||||
|
- bsr
|
||||||
|
- jsr
|
||||||
|
|
||||||
|
There are subtle differences but we will use bsr mostly
|
||||||
|
|
||||||
|
```
|
||||||
|
bsr myroutine:
|
||||||
|
|
||||||
|
myroutine:
|
||||||
|
rts
|
||||||
|
```
|
||||||
|
|
||||||
# Iteration
|
# Iteration
|
||||||
|
Done using GOTOs
|
||||||
|
```
|
||||||
|
clra //A = 0
|
||||||
|
more:
|
||||||
|
cmpa #$06 //compare A to $06 (sets the equal flag in CC if true)
|
||||||
|
beq done //if the equal flag is set, branch to done
|
||||||
|
inca //increment a
|
||||||
|
bra more //branch to more
|
||||||
|
done:
|
||||||
|
```
|
||||||
|
|
||||||
|
other instructions set flags too
|
||||||
|
|
||||||
# Input/Output
|
# Input/Output
|
||||||
|

|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Hello World
|
# Hello World
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user