        .globl  ad,cp,bt,ml,ggt,pot,output,out,input,demw
demw:   mov     #txt1,-(sp)
        jsr     pc,output
        add     #2,sp
        mov     #str1,r3
lp1:    jsr     pc,input
        movb    r0,(r3)+
        jsr     pc,out
        cmpb    #15,r0
        bne     lp1
        movb    #0,-1(r3)
        mov     #12,r0
        jsr     pc,out
        mov     #txt2,-(sp)
        jsr     pc,output
        add     #2,sp
        mov     #str2,r3
lp2:    jsr     pc,input
        movb    r0,(r3)+
        jsr     pc,out
        cmpb    #15,r0
        bne     lp2
        movb    #0,-1(r3)
        mov     #12,r0
        jsr     pc,out
        mov     #str2,-(sp)
        mov     #str1,-(sp)
lp3:    mov     #txt3,-(sp)
        jsr     pc,output
        add     #2,sp
        jsr     pc,input
        cmpb    #'a,r0
        bne     b
        jsr     pc,ad
        br      ready
b:      cmpb    #'b,r0
        bne     c
        jsr     pc,bt
        br      ready
c:      cmpb    #'c,r0
        bne     m
        jsr     pc,cp
        br      ready
m:      cmpb    #'m,r0
        bne     g
        jsr     pc,ml
        br      ready
g:      cmpb    #'g,r0
        bne     p
        jsr     pc,ggt
        br      ready
p:      cmpb    #'p,r0
        bne     lp3
        jsr     pc,pot
ready:  add     #2,sp
        jmp     demw
        halt
input:  tstb    177560
        bpl     input
        movb    177562,r0
        rts     pc
out:    tstb    177564
        bpl     out
        movb    r0,177566
        rts     pc
txt1:   .byte   15,12
        .ascii  '1. Zahl: '
        .byte   0
txt2:   .ascii  '2. Zahl: '
        .byte   0
txt3:   .ascii  'a(d)  b(t)  c(p)  m(l)  g(gt)  p(ot)  ?'
        .byte   15,12,0
str1:   .blkw   50.
str2:   .blkw   50.
        .end
