; Source for CEGMON monitor. Generated by disassembling ROM image.

        .org $F800

L0000           := $0000
L002E           := $002E
L00FD           := $00FD
L00FE           := $00FE
L0218           := $0218
L021A           := $021A
L021C           := $021C
L021E           := $021E
L0220           := $0220
L0227           := $0227
L022A           := $022A
L0233           := $0233
L2F44           := $2F44
L415A           := $415A
LA34B           := $A34B
LA374           := $A374
LA636           := $A636
LBF2D           := $BF2D
LD08C           := $D08C
LF800:  lda     $0E
        beq     LF80A
        dec     $0E
        beq     LF80A
        dec     $0E
LF80A:  lda     #$20
        sta     $0201
        jsr     LFF8F
        bpl     LF82D
        sec
        lda     $022B
        sbc     #$40
        sta     $022B
        lda     $022C
        sbc     #$00
        sta     $022C
        jsr     LFBCF
        bcs     LF82D
        jsr     LFFD1
LF82D:  stx     $0200
        jsr     LFF88
        jmp     LF8D2
LF836:  sta     $0202
        pha
        txa
        pha
        tya
        pha
        lda     $0202
        bne     LF846
        jmp     LF8D2
LF846:  ldy     $0206
        beq     LF84E
        jsr     LFCE1
LF84E:  cmp     #$5F
        beq     LF800
        cmp     #$0C
        bne     LF861
        jsr     LFF8C
        jsr     LFFD1
        stx     $0200
        beq     LF8CF
LF861:  cmp     #$0A
        beq     LF88C
        cmp     #$1E
        beq     LF8E0
        cmp     #$0B
        beq     LF87D
        cmp     #$1A
        beq     LF8D8
        cmp     #$0D
        bne     LF87A
        jsr     LFF6D
        bne     LF8D2
LF87A:  sta     $0201
LF87D:  jsr     LFF8C
        inc     $0200
        inx
        cpx     $0222
        bmi     LF8CF
        jsr     LFF70
LF88C:  jsr     LFF8C
        ldy     #$02
        jsr     LFBD2
        bcs     LF89E
        ldx     #$03
        jsr     LFDEE
        jmp     LF8CF
LF89E:  jsr     LFE28
        jsr     LFFD1
        jsr     LFDEE
        ldx     $0222
LF8AA:  jsr     L0227
        bpl     LF8AA
        inx
        jsr     LFDEE
        ldx     #$03
        jsr     LFDEE
        jsr     LFBCF
        bcc     LF8AA
        lda     #$20
LF8BF:  jsr     L022A
        bpl     LF8BF
        ldx     #$01
LF8C6:  lda     $0223,x
        sta     $0228,x
        dex
        bpl     LF8C6
LF8CF:  jsr     LFF75
LF8D2:  pla
        tay
        pla
        tax
        pla
        rts

LF8D8:  jsr     LFE59
        sta     $0201
        beq     LF904
LF8E0:  lda     #$20
        jsr     LFF8F
        jsr     LFFD1
LF8E8:  ldx     $0222
        lda     #$20
LF8ED:  jsr     L022A
        bpl     LF8ED
        sta     $0201
        ldy     #$02
        jsr     LFBD2
        bcs     LF904
        ldx     #$03
        jsr     LFDEE
        jmp     LF8E8
LF904:  jsr     LFFD1
        stx     $0200
        beq     LF8D2
LF90C:  jsr     LF9A6
LF90F:  jsr     LFBF5
        jsr     LFEB6
        jsr     LFBE6
        jsr     LFBE0
        ldx     #$08
        stx     L00FD
LF91F:  jsr     LFBE6
        jsr     LFEF0
        jsr     LFBEB
        bcs     LF97B
        jsr     LFEF9
        dec     L00FD
        bne     LF91F
        beq     LF90F
LF933:  jsr     LFFBD
        jsr     LFDE4
        bcs     LF97E
LF93B:  ldx     $E4
        txs
        lda     $E6
        pha
        lda     $E5
        pha
        lda     $E3
        pha
        lda     $E0
        ldx     $E1
        ldy     $E2
        rti
LF94E:  ldx     #$03
LF950:  lda     LFA4B,x
        sta     $0234,x
        dex
        bne     LF950
        jsr     LFE8D
        jsr     LF9B5
        lda     (L00FE),y
        sta     $E7
        tya
        sta     (L00FE),y
        beq     LF97E
LF968:  jmp     LFA7E
LF96B:  dec     $FB
        bne     LF9E8
LF96F:  beq     LF90C
LF971:  rts

LF972:  lda     $FB
        bne     LF971
        lda     #$3F
        jsr     LFFEE
LF97B:  ldx     #$28
        txs
LF97E:  jsr     LFBF5
        ldy     #$00
        sty     $FB
        jsr     LFBE0
LF988:  jsr     LFE8D
        cmp     #$4D
        beq     LF933
        cmp     #$52
        beq     LF93B
        cmp     #$5A
        beq     LF94E
        cmp     #$53
        beq     LF968
        cmp     #$4C
        beq     LF96B
        cmp     #$55
        bne     LF9D6
        jmp     (L0233)
LF9A6:  jsr     LFE8D
        jsr     LF9B5
        jsr     LFBE3
        ldx     #$00
LF9B1:  jsr     LFE8D
        .byte   $2C
LF9B5:  ldx     #$05
        jsr     LF9C0
        jsr     LFE8D
        .byte   $2C
LF9BE:  ldx     #$03
LF9C0:  jsr     LF9C6
        jsr     LFE8D
LF9C6:  cmp     #$2E
        beq     LF988
        cmp     #$2F
        beq     LF9E8
        jsr     LFE93
        bmi     LF972
        jmp     LFEDA
LF9D6:  cmp     #$54
        beq     LF96F
        jsr     LF9B5
LF9DD:  lda     #$2F
        jsr     LFFEE
        jsr     LFEF0
        jsr     LFBE6
LF9E8:  jsr     LFE8D
        cmp     #$47
        bne     LF9F2
        jmp     (L00FE)
LF9F2:  cmp     #$2C
        bne     LF9FC
        jsr     LFEF9
        jmp     LF9E8
LF9FC:  cmp     #$0A
        beq     LFA16
        cmp     #$0D
        beq     LFA1B
        cmp     #$5E
        beq     LFA21
        cmp     #$27
        beq     LFA3A
        jsr     LF9BE
        lda     $FC
        sta     (L00FE),y
LFA13:  jmp     LF9E8
LFA16:  lda     #$0D
        jsr     LFFEE
LFA1B:  jsr     LFEF9
        jmp     LFA31
LFA21:  sec
        lda     L00FE
        sbc     #$01
        sta     L00FE
        lda     $FF
        sbc     #$00
        sta     $FF
LFA2E:  jsr     LFBF5
LFA31:  jsr     LFEB6
        jmp     LF9DD
        jsr     LFEF7
LFA3A:  jsr     LFE8D
        cmp     #$27
        bne     LFA46
        jsr     LFBE3
        bne     LFA13
LFA46:  cmp     #$0D
        beq     LFA2E
        .byte   $D0
LFA4B:  .byte   $EB
        jmp     LFA4F
LFA4F:  sta     $E0
        pla
        pha
        and     #$10
        bne     LFA5A
        lda     $E0
        rti
LFA5A:  stx     $E1
        sty     $E2
        pla
        sta     $E3
        cld
        sec
        pla
        sbc     #$02
        sta     $E5
        pla
        sbc     #$00
        sta     $E6
        tsx
        stx     $E4
        ldy     #$00
        lda     $E7
        sta     ($E5),y
        lda     #$E0
        sta     L00FE
        sty     $FF
        bne     LFA2E
LFA7E:  jsr     LFFBD
        jsr     LFFF7
        jsr     LFEE9
        jsr     LFFEE
        jsr     LFFE3
        lda     #$2F
        jsr     LFFEE
        bne     LFA97
LFA94:  jsr     LFEF9
LFA97:  jsr     LFEF0
        lda     #$0D
        jsr     LFCB1
        jsr     LFBEB
        bcc     LFA94
        lda     $E4
        ldx     $E5
        sta     L00FE
        stx     $FF
        jsr     LFFE3
        lda     #$47
        jsr     LFFEE
        jsr     LFFAC
        sty     $0205
        jmp     LF97E
LFABD:  txa
        pha
        tya
        pha
        lda     $0204
        bpl     LFB1F
LFAC6:  ldy     $022F
        lda     $0231
        sta     $E4
        lda     $0232
        sta     $E5
        lda     ($E4),y
        sta     $0230
        lda     #$A1
        sta     ($E4),y
        jsr     LFD00
        lda     $0230
        sta     ($E4),y
        lda     $0215
        cmp     #$11
        beq     LFB13
        cmp     #$01
        beq     LFB0D
        cmp     #$04
        beq     LFB07
        cmp     #$13
        beq     LFB01
        cmp     #$06
        bne     LFB22
        jsr     LFB7C
        jmp     LFAC6
LFB01:  jsr     LFE28
        jmp     LFAC6
LFB07:  jsr     LFB6B
        jmp     LFAC6
LFB0D:  jsr     LFE19
        jmp     LFAC6
LFB13:  lda     $0230
        sta     $0215
        jsr     LFB6B
        jmp     LFB43
LFB1F:  jsr     LFD00
LFB22:  cmp     #$05
        bne     LFB43
        lda     $0204
        eor     #$FF
        sta     $0204
        bpl     LFB1F
        lda     $022B
        sta     $0231
        lda     $022C
        sta     $0232
        ldx     #$00
        stx     $022F
        beq     LFAC6
LFB43:  jmp     LFDD3
        bit     $0203
        bpl     LFB68
LFB4B:  lda     #$FD
        sta     $DF00
        lda     #$10
        bit     $DF00
        beq     LFB61
LFB57:  lda     $F000
        lsr     a
        bcc     LFB4B
        lda     $F001
        rts

LFB61:  lda     #$00
        sta     $FB
        sta     $0203
LFB68:  jmp     LFABD
LFB6B:  ldx     $0222
        cpx     $022F
        beq     LFB77
        inc     $022F
        rts

LFB77:  ldx     #$00
        stx     $022F
LFB7C:  clc
        lda     $0231
        adc     #$40
        sta     $0231
        lda     $0232
        adc     #$00
        cmp     #$D8
        bne     LFB90
        lda     #$D0
LFB90:  sta     $0232
LFB93:  rts

        lda     $0212
        bne     LFB93
        lda     #$FE
        sta     $DF00
        bit     $DF00
        bvs     LFB93
        lda     #$FB
        sta     $DF00
        bit     $DF00
        bvs     LFB93
        lda     #$03
        jmp     LA636
LFBB2:  lsr     $FB
        .byte   $9B
        .byte   $FF
        sty     $FB,x
LFBB8:  bvs     LFBB8
        .byte   $7B
        inc     $803F,x
        bne     LFC00
        .byte   $D7
        lda     LD08C,x
        sta     LD08C,x
        dex
        rts

        brk
        jsr     LD08C
        dey
        .byte   $F9
LFBCF:  ldx     $0222
LFBD2:  sec
        lda     $022B
        sbc     $0223,y
        lda     $022C
        sbc     $0224,y
        rts

LFBE0:  lda     #$3E
        .byte   $2C
LFBE3:  lda     #$2C
        .byte   $2C
LFBE6:  lda     #$20
        jmp     LFFEE
LFBEB:  sec
        lda     L00FE
        sbc     $F9
        lda     $FF
        sbc     $FA
        rts

LFBF5:  lda     #$0D
        jsr     LFFEE
        lda     #$0A
        jmp     LFFEE
        rti
LFC00:  jsr     LFC0C
        jmp     (L00FD)
        jsr     LFC0C
        jmp     LFE00
LFC0C:  ldy     #$00
        sty     $C001
        sty     $C000
        ldx     #$04
        stx     $C001
        sty     $C003
        dey
        sty     $C002
        stx     $C003
        sty     $C002
        lda     #$FB
        bne     LFC33
LFC2A:  lda     #$02
        bit     $C000
        beq     LFC4D
        lda     #$FF
LFC33:  sta     $C002
        jsr     LFCA5
        and     #$F7
        sta     $C002
        jsr     LFCA5
        ora     #$08
        sta     $C002
        ldx     #$18
        jsr     LFC91
        beq     LFC2A
LFC4D:  ldx     #$7F
        stx     $C002
        jsr     LFC91
LFC55:  lda     $C000
        bmi     LFC55
LFC5A:  lda     $C000
        bpl     LFC5A
        lda     #$03
        sta     $C010
        lda     #$58
        sta     $C010
        jsr     LFC9C
        sta     L00FE
        tax
        jsr     LFC9C
        sta     L00FD
        jsr     LFC9C
        sta     $FF
        ldy     #$00
LFC7B:  jsr     LFC9C
        sta     (L00FD),y
        iny
        bne     LFC7B
        inc     L00FE
        dec     $FF
        bne     LFC7B
        stx     L00FE
        lda     #$FF
        sta     $C002
        rts

LFC91:  ldy     #$F8
LFC93:  dey
        bne     LFC93
        eor     $FF,x
        dex
        bne     LFC91
        rts

LFC9C:  lda     $C010
        lsr     a
        bcc     LFC9C
        lda     $C011
LFCA5:  rts

LFCA6:  lda     #$03
        sta     $F000
        lda     #$11
        sta     $F000
        rts

LFCB1:  pha
LFCB2:  lda     $F000
        lsr     a
        lsr     a
        bcc     LFCB2
        pla
        sta     $F001
        rts

LFCBE:  eor     #$FF
        sta     $DF00
        eor     #$FF
        rts

LFCC6:  pha
        jsr     LFCCF
        tax
        pla
        dex
        inx
        rts

LFCCF:  lda     $DF00
        eor     #$FF
        rts

        cmp     #$5F
        beq     LFCDC
        jmp     LA374
LFCDC:  jmp     LA34B
LFCDF:  ldy     #$10
LFCE1:  ldx     #$40
LFCE3:  dex
        bne     LFCE3
        dey
        bne     LFCE1
        rts

LFCEA:  .byte "CEGMON(C)1980 D/C/W/M?"

LFD00:  txa
        pha
        tya
        pha
LFD04:  lda     #$80
LFD06:  jsr     LFCBE
        jsr     LFCC6
        bne     LFD13
        lsr     a
        bne     LFD06
        beq     LFD3A
LFD13:  lsr     a
        bcc     LFD1F
        txa
        and     #$20
        beq     LFD3A
        lda     #$1B
        bne     LFD50
LFD1F:  jsr     LFE86
        tya
        sta     $0215
        asl     a
        asl     a
        asl     a
        sec
        sbc     $0215
        sta     $0215
        txa
        lsr     a
        asl     a
        jsr     LFE86
        beq     LFD47
        lda     #$00
LFD3A:  sta     $0216
LFD3D:  sta     $0213
        lda     #$02
        sta     $0214
        bne     LFD04
LFD47:  clc
        tya
        adc     $0215
        tay
        lda     LFF3B,y
LFD50:  cmp     $0213
        bne     LFD3D
        dec     $0214
        beq     LFD5F
        jsr     LFCDF
        beq     LFD04
LFD5F:  ldx     #$64
        cmp     $0216
        bne     LFD68
        ldx     #$0F
LFD68:  stx     $0214
        sta     $0216
        cmp     #$21
        bmi     LFDD0
        cmp     #$5F
        beq     LFDD0
        lda     #$01
        jsr     LFCBE
        jsr     LFCCF
        sta     $0215
        and     #$01
        tax
        lda     $0215
        and     #$06
        bne     LFDA2
        bit     $0213
        bvc     LFDBB
        txa
        eor     #$01
        and     #$01
        beq     LFDBB
        lda     #$20
        bit     $0215
        bvc     LFDC3
        lda     #$C0
        bne     LFDC3
LFDA2:  bit     $0213
        bvc     LFDAA
        txa
        beq     LFDBB
LFDAA:  ldy     $0213
        cpy     #$31
        bcc     LFDB9
        cpy     #$3C
        bcs     LFDB9
        lda     #$F0
        bne     LFDBB
LFDB9:  lda     #$10
LFDBB:  bit     $0215
        bvc     LFDC3
        clc
        adc     #$C0
LFDC3:  clc
        adc     $0213
        and     #$7F
        bit     $0215
        bpl     LFDD0
        ora     #$80
LFDD0:  sta     $0215
LFDD3:  pla
        tay
        pla
        tax
        lda     $0215
        rts

LFDDB:  jsr     LFEF9
        inc     $E4
        bne     LFDE4
        inc     $E5
LFDE4:  lda     (L00FE),y
        sta     ($E4),y
        jsr     LFBEB
        bcc     LFDDB
        rts

LFDEE:  clc
        lda     #$40
        adc     $0228,x
        sta     $0228,x
        lda     #$00
        adc     $0229,x
        sta     $0229,x
        rts

LFE00:  ldx     #$28
        txs
        cld
        jsr     LFCA6
        jsr     LFE40
        nop
        nop
        jsr     LFE59
        sta     $0201
        sty     L00FE
        sty     $FF
        jmp     LF97E
LFE19:  ldx     $022F
        beq     LFE22
        dec     $022F
        rts

LFE22:  ldx     $0222
        stx     $022F
LFE28:  sec
        lda     $0231
        sbc     #$40
        sta     $0231
        lda     $0232
        sbc     #$00
        cmp     #$CF
        bne     LFE3C
        lda     #$D7
LFE3C:  sta     $0232
        rts

LFE40:  ldy     #$1C
LFE42:  lda     LFBB2,y
        sta     L0218,y
        dey
        bpl     LFE42
        ldy     #$07
        lda     #$00
        sta     $0212
LFE52:  sta     $01FF,y
        dey
        bne     LFE52
        rts

LFE59:  ldy     #$00
        sty     $F9
        lda     #$D0
        sta     $FA
        ldx     #$08
        lda     #$20
LFE65:  sta     ($F9),y
        iny
        bne     LFE65
        inc     $FA
        dex
        bne     LFE65
        rts

        pha
        dec     $0203
        lda     #$00
LFE76:  sta     $0205
        pla
        rts

        pha
        lda     #$01
        bne     LFE76
LFE80:  jsr     LFB57
        and     #$7F
        rts

LFE86:  ldy     #$08
LFE88:  dey
        asl     a
        bcc     LFE88
        rts

LFE8D:  jsr     LFEE9
        jmp     LFFEE
LFE93:  cmp     #$30
        bmi     LFEA9
        cmp     #$3A
        bmi     LFEA6
        cmp     #$41
        bmi     LFEA9
        cmp     #$47
        bpl     LFEA9
        sec
        sbc     #$07
LFEA6:  and     #$0F
        rts

LFEA9:  lda     #$80
        rts

        jsr     LFEB6
        nop
        nop
        jsr     LFBE6
        bne     LFEBD
LFEB6:  ldx     #$03
        jsr     LFEBF
        dex
        .byte   $2C
LFEBD:  ldx     #$00
LFEBF:  lda     $FC,x
        lsr     a
        lsr     a
        lsr     a
        lsr     a
        jsr     LFECA
        lda     $FC,x
LFECA:  and     #$0F
        ora     #$30
        cmp     #$3A
        bmi     LFED5
        clc
        adc     #$07
LFED5:  jmp     LFFEE
        nop
        nop
LFEDA:  ldy     #$04
        asl     a
        asl     a
        asl     a
        asl     a
LFEE0:  rol     a
        rol     $F9,x
        rol     $FA,x
        dey
        bne     LFEE0
        rts

LFEE9:  lda     $FB
        bne     LFE80
        jmp     LFD00
LFEF0:  lda     (L00FE),y
        sta     $FC
        jmp     LFEBD
LFEF7:  sta     (L00FE),y
LFEF9:  inc     L00FE
        bne     LFEFF
        inc     $FF
LFEFF:  rts

LFF00:  cld
        ldx     #$28
        txs
        jsr     LFCA6
        jsr     LFE40
        jsr     LFE59
        jsr     LFFD1
LFF10:  lda     LFCEA,y
        jsr     LFFEE
        iny
        cpy     #$16
        bne     LFF10
        jsr     LFFEB
        and     #$DF
        cmp     #'D'
        bne     LFF27
        jmp     LFC00
LFF27:  cmp     #$4D
        bne     LFF2E
        jmp     LFE00
LFF2E:  cmp     #$57
        bne     LFF35
        jmp     L0000
LFF35:  cmp     #$43
        bne     LFF00
        .byte   $4C
        .byte   $11
LFF3B:  .byte   $BD
        .byte   "P;/ ZAQ,MNBVCXKJHGFDSIUYTREW"
        .byte $00, $00, $0D, $0A, 'O'
        jmp     L002E
        .byte   "_-:0987654321"
LFF6D:  jsr     LFF8C
LFF70:  ldx     #$00
        stx     $0200
LFF75:  ldx     $0200
        lda     #$BD
        sta     L022A
        jsr     L022A
        sta     $0201
        lda     #$9D
        sta     L022A
LFF88:  lda     #$5F
        bne     LFF8F
LFF8C:  lda     $0201
LFF8F:  ldx     $0200
        jmp     L022A
        jsr     LBF2D
        jmp     LFF9E
        jsr     LF836
LFF9E:  pha
        lda     $0205
        beq     LFFBB
        pla
        jsr     LFCB1
        cmp     #$0D
        bne     LFFBC
LFFAC:  pha
        txa
        pha
        ldx     #$0A
        lda     #$00
LFFB3:  jsr     LFCB1
        dex
        bne     LFFB3
        pla
        tax
LFFBB:  pla
LFFBC:  rts

LFFBD:  jsr     LF9A6
        jsr     LFBE0
        ldx     #$03
        jsr     LF9B1
        lda     $FC
        ldx     L00FD
        sta     $E4
        stx     $E5
        rts

LFFD1:  ldx     #$02
LFFD3:  lda     $0222,x
        sta     L0227,x
        sta     L022A,x
        dex
        bne     LFFD3
        rts

        eor     $012F
LFFE3:  lda     #$2E
        jsr     LFFEE
        jmp     LFEB6
LFFEB:  jmp     (L0218)
LFFEE:  jmp     (L021A)
        jmp     (L021C)
        jmp     (L021E)
LFFF7:  jmp     (L0220)
        .word   $0237           ; NMI vector
        .word   $FF00           ; Reset vector
        .word   $0235           ; BRK/IRQ vector
