one-pass

A program of Temporaries and Liveness.

main.ngp

modules { "scan.asm" }

scan.asm

.section
input
        .byte 3, 1, 4, 1, 5
.ends

.section zeropage
largest
        .res 1
.ends

.section zeropage
above
        .res 1
.ends

; tag body
.proc entry
best    .ztemp 1
tally   .ztemp 1

        lda #0
        sta best
        sta tally
        ldx #4
@scan   lda input,x
        cmp best
        jcc @kept
        sta best
@kept   lda input,x
        cmp #3
        jcc @next
        inc tally
@next   dex
        bpl @scan
        lda best
        sta largest
        lda tally
        sta above
        rts
.endp
; end body

Memory map

  1. phase04 zero page, 43 bytes
AddressBytesSectionModuleKindPhasesWaits
$0080–$00801entry.tallyscantemporary0
$0081–$00811entry.bestscantemporary0
$0082–$00821abovescansection0
$0083–$00831largestscansection0
$2000–$20045inputscansection0
$2005–$202A38entryscanproc0