kontrg equ $10
kontst equ $11
sprrg  equ $12
optio  equ %0111
re_f   equ %00001000
rie_f  equ %00010000

       org $fffe
       fdb start
       org $fff0
       fdb sprejmi
       org $d000
st     rmb 1
StFram rmb 1
StOverr rmb 1
       org $d0ff
buff   rmb 1
       org $a000
start  lds #$3000
       cli
       ldaa #optio
       staa kontrg
       ldaa #re_f
       oraa #rie_f
       staa kontst

       wai

sprejmi ldaa kontst
        anda #%11000000

        cmpa #%10000000
        beq prav

        cmpa #%01000000
        beq fram_e

        cmpa #%11000000
        beq overr_e


prav    ldaa sprrg
        staa buff
        inc st
        ldaa st
        cmpa #$4
ponovi  beq ponovi
        rti

fram_e  inc StFram
        bra ven
overr_e inc StOverr
ven     ldaa sprrg
        rti
