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

  1. phase00 zero page, 45 bytes
AddressBytesSectionModuleKindPhasesWaits
$2000–$20001statestatesection0
$2001–$20011speedstatesection0
$2002–$202C43stepstateproc0