dispatch-65sc02
A program of Instructions.
main.ngp
; tag cpu
target {
cpu "65sc02"
region $0080 .. $00FF ram
region $2000 .. $BFFF ram
}
; end cpu
modules { "../dispatch/state.asm" }
container raw
state.asm state
.section
state
.res 1
.ends
.section
speed
.res 1
.ends
; tag step
; Four positions of this Proc, chosen by what is in `A`. The clamp is the
; writer's: the statement indexes a table and does not check, exactly as any
; other index does not.
.proc step
lda state
cmp #3
jcc @ok
lda #3
@ok .dispatch @idle, @walk, @run, @stop
@idle lda #0
jmp @set
@walk lda #1
jmp @set
@run lda #4
jmp @set
@stop lda #0
@set sta speed
rts
.endp
; end step
Memory map
- phase00 zero page, 45 bytes
| Address | Bytes | Section | Module | Kind | Phases | Waits |
|---|---|---|---|---|---|---|
| $2000–$2000 | 1 | state | state | section | 0 | |
| $2001–$2001 | 1 | speed | state | section | 0 | |
| $2002–$202C | 43 | step | state | proc | 0 |