dispatch
A program of Roots.
main.ngp
target { region $0080 .. $00FF ram region $2000 .. $BFFF ram }
modules { "pick.asm" }
container raw
pick.asm
.section
input
.byte 3, 1, 4, 1, 5
.ends
.section
out
.res 1
.ends
; tag dispatch
; The largest of five, put into one of three bands. The two Temporaries are
; used in stretches that do not overlap.
.proc entry
best .ztemp 1
band .ztemp 1
lda #0
sta best
ldx #4
@pick lda input,x
cmp best
jcc @kept
sta best
@kept dex
bpl @pick
; tag choose
; Where the three bands are chosen. The statement names the positions it goes
; to, so they are Successors of it and the Proc's flow is known.
lda best
cmp #3
jcc @ok
lda #2
@ok .dispatch @low, @mid, @high
; end choose
@low lda #0
jmp @done
@mid lda #1
jmp @done
@high lda #2
@done
sta band
lda band
sta out
rts
.endp
; end dispatch
Memory map
- phase01 zero page, 68 bytes
| Address | Bytes | Section | Module | Kind | Phases | Waits |
|---|---|---|---|---|---|---|
| $0080–$0080 | 1 | entry.band | pick | temporary | 0 | |
| $0080–$0080 | 1 | entry.best | pick | temporary | 0 | |
| $2000–$2004 | 5 | input | pick | section | 0 | |
| $2005–$2005 | 1 | out | pick | section | 0 | |
| $2006–$2043 | 62 | entry | pick | proc | 0 |