two-passes
A program of Temporaries and Liveness.
main.ngp
modules { "scan.asm" }
scan.asm
; tag data
.section
input
.byte 3, 1, 4, 1, 5
.ends
.section zeropage
largest
.res 1
.ends
.section zeropage
above
.res 1
.ends
; end data
; tag body
.proc entry
best .ztemp 1
tally .ztemp 1
lda #0
sta best
ldx #4
@pick lda input,x
cmp best
jcc @kept
sta best
@kept dex
bpl @pick
lda best
sta largest
lda #0
sta tally
ldx #4
@count lda input,x
cmp #3
jcc @next
inc tally
@next dex
bpl @count
lda tally
sta above
rts
.endp
; end body
Memory map
- phase03 zero page, 50 bytes
| Address | Bytes | Section | Module | Kind | Phases | Waits |
|---|---|---|---|---|---|---|
| $0080–$0080 | 1 | largest | scan | section | 0 | |
| $0081–$0081 | 1 | above | scan | section | 0 | |
| $0082–$0082 | 1 | entry.best | scan | temporary | 0 | |
| $0082–$0082 | 1 | entry.tally | scan | temporary | 0 | |
| $2000–$2004 | 5 | input | scan | section | 0 | |
| $2005–$2031 | 45 | entry | scan | proc | 0 |