*  version 11c dpbs 1/26/84

          if       iodriverpoll
profilechain equ   nextdpb
          fin      iodriverpoll
          if       iodriverbody
          ifund    nexdpb
nextdpb   set      0
          fin      nextdpb
          page     malvt profile (included in all standard I/O packages)

profileloc.malvt set *
profilenum.malvt   equ 1

thisdpb   set      *
          fcb      profilenum.malvt               profile number
          fdb      profilenam.malvt               profile name
          fcb      dvtyp.console
          fdb      nextdpb                        next profile
          fcb      80                             default width
          fcb      24                             default depth
          fcb      5                              flags
          fdb      6*tickspersecond+ntimeoutblocks
          okrts                                   input translation routine
        if       m6800!m6801
          nop
        fin

        okrts                                     set output coloring
        if       m6800!m6801
          nop
        fin

        okrts                                     set background coloring
        if       m6800!m6801
          nop
        fin

        jmp     sdos+sdos:vtmalnewpage
        jmp     sdos+sdos:vtmalnewline
        jmp     sdos+sdos:vtmaleeol
        jmp     sdos+sdos:vtmalposition

*       fcb       0,0,0,0,0,0,0,0               gpinit data

profilenam.malvt   fcb 5
           fcc /MalVT/

nextdpb   set      thisdpb
          page     mallpt profile (included in all standard I/O packages)

profileloc.mallpt set *
profilenum.mallpt   equ 9

thisdpb   set      *
          fcb      profilenum.mallpt               profile number
          fdb      profilenam.mallpt              profile name
          fcb      dvtyp.printer
          fdb      nextdpb                        next profile
          fcb      132                            default width
          fcb      66                             default depth
          fcb      3                              flags
          fdb      6*tickspersecond+ntimeoutblocks
          okrts                                   input translation routine
          if       m6800!m6801
          nop
          fin

        okrts                                     set output coloring
        if       m6800!m6801
          nop
        fin

        okrts                                     set background coloring
        if       m6800!m6801
          nop
        fin

        jmp     sdos+sdos:vtmalnewpage
        jmp     sdos+sdos:vtmalnewline
        jmp     sdos+sdos:vtmaleeol

        fcb    0
        nop
        nop

*        fcb       0,0,0,0,0,0,0,0               gpinit data

profilenam.mallpt
           fcb     6
           fcc /MalLPT/

nextdpb   set      thisdpb
          page     hardcopyvt profile and support code (included in all standard I/O packages)


profileloc.hardcopyvt set *
profilenum.hardcopyvt   equ 6

thisdpb   set      *
          fcb      profilenum.hardcopyvt          profile number
          fdb      profilenam.hardcopyvt          profile name
          fcb      dvtyp.console
          fdb      nextdpb                        next profile
          fcb      80                             default width
          fcb      0                              default depth
          fcb      20                             flags
          fdb      6*tickspersecond+ntimeoutblocks

          okrts                                   perform input translation
          if       m6800!m6801
          nop
          fin

        okrts                                     set output coloring
        if       m6800!m6801
          nop
        fin

        okrts                                     set background coloring
        if       m6800!m6801
          nop
        fin


        jmp     sdos+sdos:vtnewpageff
        jmp     sdos+sdos:vtnewlinecrlf
        jmp     sdos+sdos:vtsimeeol

        fcb    0
        nop
        nop

*        fcb       0,0,0,0,0,0,0,0               gpinit data

nextdpb   set      thisdpb

profilenam.hardcopyvt   fcb            10
        fcc /HardCopyVT/


         ifund    profile.TI810
          else
          page     TI810 profile and support code
profileloc.TI810 set *
profilenum.TI810   equ 12

thisdpb   set      *
          fcb      profilenum.TI810              profile number
          fdb      profilenam.TI810              profile name
          fcb      dvtyp.printer
          fdb      nextdpb                        next profile
          fcb      132                             default width
          fcb      66                             default depth
          fcb      4                              flags
          fdb      6*tickspersecond+ntimeoutblocks
          okrts                                   input translation routine
          if       m6800!m6801
          nop
          fin

        okrts                                     set output coloring
        if       m6800!m6801
          nop
        fin

        okrts                                     set background coloring
        if       m6800!m6801
          nop
        fin

        jmp     sdos+sdos:vtnewpageff
        jmp     sdos+sdos:vtnewlinecrlf
        jmp     sdos+sdos:vtsimeeol
        fcb    0
        nop
        nop

*        fcb       0,0,0,0,0,0,0,0               gpinit data
nextdpb   set      thisdpb


profilenam.TI810   fcb 5
        fcc /TI810/
          fin      profile.TI810

          ifund    profile.cenlpt
          else
          page     cenlpt profile and support code
profileloc.cenlpt set *
profilenum.cenlpt   equ 10

thisdpb   set      *
          fcb      profilenum.cenlpt              profile number
          fdb      profilenam.cenlpt              profile name
          fcb      dvtyp.printer
          fdb      nextdpb                        next profile
          fcb      80                             default width
          fcb      24                             default depth
          fcb      4                              flags
          fdb      6*tickspersecond+ntimeoutblocks
          okrts                                   input translation routine
          if       m6800!m6801
          nop
          fin

        okrts                                     set output coloring
        if       m6800!m6801
          nop
        fin

        okrts                                     set background coloring
        if       m6800!m6801
          nop
        fin

        jmp     sdos+sdos:vtnewpageff
        jmp     sdos+sdos:vtnewlinecrlf
        jmp     sdos+sdos:vtsimeeol
        fcb    0
        nop
        nop

*        fcb       0,0,0,0,0,0,0,0               gpinit data
nextdpb   set      thisdpb

profilenam.Cenlpt   fcb 6
        fcc /CenLPT/


          fin      profile.cenlpt






          ifund    profile.rs232lpt
          else
          page     rs232lpt profile and support code
;   Operates a printer using standard ascii control codes for everything

profileloc.rs232lpt set *
profilenum.rs232lpt   equ 11

thisdpb   set      *
          fcb      profilenum.rs232lpt            profile number
          fdb      profilenam.rs232lpt            profile name
          fcb      dvtyp.printer
          fdb      nextdpb                        next profile
          fcb      132                            default width
          fcb      66                             default depth
          fcb      2                              flags
          fdb      6*tickspersecond+ntimeoutblocks
          okrts                                   input translation routine
          if       m6800!m6801
          nop
          fin


        okrts                                     set output coloring
        if       m6800!m6801
          nop
        fin

        okrts                                     set background coloring
        if       m6800!m6801
          nop
        fin

        jmp     sdos+sdos:vtnewpageff
        jmp     sdos+sdos:vtnewlinecrlf
        jmp     sdos+sdos:vtsimeeol

        fcb    0
        nop
        nop

*        fcb       0,0,0,0,0,0,0,0               gpinit data

nextdpb   set      thisdpb

profilenam.rs232lpt   fcb              9
        fcc /RS232LPT/

          fin      profile.rs232lpt
          ifund    profile.epsonmx80wide
          else
          page     epsonmx80wide profile and support code
;   Operates a printer using standard ascii control codes for everything

profileloc.epsonmx80wide set *
profilenum.epsonmx80wide   equ 15

thisdpb   set      *
          fcb      profilenum.epsonmx80wide       profile number
          fdb      profilenam.epsonmx80wide       profile name
          fcb      dvtyp.printer
          fdb      nextdpb                        next profile
          fcb      132                            default width
          fcb      66                             default depth
          fcb      2                              flags
          fdb      50*tickspersecond+ntimeoutblocks
          okrts                                   input translation routine
          if       m6800!m6801
          nop
          fin

        okrts                                     set output coloring
        if       m6800!m6801
          nop
        fin

        okrts                                     set background coloring
        if       m6800!m6801
          nop
        fin

        jmp     sdos+sdos:vtnewpageff
        jmp     sdos+sdos:vtnewlinecrlf
        jmp     sdos+sdos:vtsimeeol

        fcb    0
        nop
        nop

*        fcb       0,0,0,0,0,0,0,0               gpinit data

nextdpb   set      thisdpb


profilenam.epsonmx80wide   fcb         13
        fcc /Epsonmx80wide/
          fin      profile.epsonmx80wide

          ifund    profile.epsonmx80
          else

profileloc.epsonmx80 set *
profilenum.epsonmx80   equ 14

thisdpb   set      *
          fcb      profilenum.epsonmx80           profile number
          fdb      profilenam.epsonmx80           profile name
          fcb      dvtyp.printer
          fdb      nextdpb                        next profile
          fcb      80                            default width
          fcb      66                             default depth
          fcb      2                              flags
          fdb      50*tickspersecond+ntimeoutblocks
          okrts                                   input translation routine
          if       m6800!m6801
          nop
          fin

        okrts                                     set output coloring
        if       m6800!m6801
          nop
        fin

        okrts                                     set background coloring
        if       m6800!m6801
          nop
        fin

        jmp     sdos+sdos:vtnewpageff
        jmp     sdos+sdos:vtnewlinecrlf
        jmp     sdos+sdos:vtsimeeol
        fcb    00
        nop
        nop

*        fcb       0,0,0,0,0,0,0,0               gpinit data

nextdpb   set      thisdpb

profilenam.epsonmx80   fcb             9
        fcc /Epsonmx80/

          fin      profile.epsonmx80
          page     epsonmx80 profile and support code
;   Operates a printer using standard ascii control codes for everything

          ifund    profile.epsonmx100
          else

profileloc.epsonmx100 set *
profilenum.epsonmx100   equ 16

thisdpb   set      *
          fcb      profilenum.epsonmx100               profile number
          fdb      profilenam.epsonmx100           profile name
          fcb      dvtyp.printer
          fdb      nextdpb                        next profile
          fcb      132                            default width
          fcb      66                             default depth
          fcb      2                              flags
          fdb      20*tickspersecond+ntimeoutblocks
          okrts                                   input translation routine
          if       m6800!m6801
          nop
          fin

        okrts                                     set output coloring
        if       m6800!m6801
          nop
        fin

        okrts                                     set background coloring
        if       m6800!m6801
          nop
        fin
  

        jmp     sdos+sdos:vtnewpageff
        jmp     sdos+sdos:vtnewlinecrlf
        jmp     sdos+sdos:vtsimeeol
        fcb    0
        nop
        nop

 *       fcb       0,0,0,0,0,0,0,0               gpinit data

nextdpb   set      thisdpb

profilenam.epsonmx100   fcb            10
        fcc /Epsonmx100/

          fin      profile.epsonmx100
          ifund    profile.adm1
          else
          page     adm1 profile and support code
profileloc.adm1 set *
profilenum.adm1   equ 2

thisdpb   set      *
          fcb      profilenum.adm1                profile number
          fdb      profilenam.adm1                profile name
          fcb      dvtyp.console
          fdb      nextdpb                        next profile
          fcb      80                             default width
          fcb      24                             default depth
          fcb      4                              flags
          fdb      6*tickspersecond+ntimeoutblocks
          okrts                                   perform input translation
          if       m6800!m6801
          nop

          fin

        okrts                                     set output coloring
        if       m6800!m6801
          nop
        fin

        okrts                                     set background coloring
        if       m6800!m6801
          nop
        fin

        jmp     specialoutput:adm1.form
        jmp     specialoutput:adm1.newline
        jmp     sdos+sdos:vtsimeeol
        jmp     specialoutput:adm1.posn

*        fcb       0,0,0,0,0,0,0,0               gpinit data

nextdpb   set      thisdpb


profilenam.adm1   fcb   4
        fcc /Adm1/

          page

specialoutput:adm1.newline
          ldaa     #ascii:cr                      output <cr>...
          jsr      tlbuffer,x
          ldaa     #ascii:lf                      then <lf>
          jsr      tlbuffer,x
specialoutput:adm1.pad ; output pad to let CRT keep up
          clra                                    a null pad byte
          jsr      tlbuffer,x
          clra                                    a null pad byte
          jsr      tlbuffer,x
          clra                                    a null pad byte
          jsr      tlbuffer,x
          clra                                    a null pad byte
          jmp      tlbuffer,x

specialoutput:adm1.form
          ldaa     #ascii:esc
          jsr      tlbuffer,x
          ldaa     #'*
          jsr      tlbuffer,x
          bra      specialoutput:adm1.pad
          page
specialoutput:adm1.posn
          ldaa     #ascii:esc
          jsr      sdos+sdos:vttlstore
          ldaa     #'=                            set up to do a position fn
          jsr      sdos+sdos:vttlstore
          tsx
          ldaa     2,x
          adda     #$20
          ldx      dcbpointer
          jsr      sdos+sdos:vttlstore
          tsx
          ldaa     3,x
          adda     #$20
          ldx      dcbpointer
          jsr      sdos+sdos:vttlstore
          okrts
          fin      profile.adm1
          ifund    profile.adm3
          else
          page     adm3 profile and support code
profileloc.adm3 set *
profilenum.adm3   equ 3

thisdpb   set      *
          fcb      profilenum.adm3                profile number
          fdb      profilenam.adm3                profile name
          fcb      dvtyp.console
          fdb      nextdpb                        next profile
          fcb      80                             default width
          fcb      24                             default depth
          fcb      4                              flags
          fdb      6*tickspersecond+ntimeoutblocks
          jmp      xlatei:adm3                    perform input translation

        okrts                                     set output coloring
        if       m6800!m6801
          nop
        fin

        okrts                                     set background coloring
        if       m6800!m6801
          nop
        fin


        jmp     specialoutput:adm3clear
        jmp     sdos+sdos:vtnewlinecrlf
        jmp     sdos+sdos:vtsimeeol
        jmp     specialoutput:adm3posn

*        fcb       0,0,0,0,0,0,0,0               gpinit data

profilenam.adm3   fcb   4
        fcc /Adm3/

nextdpb   set      thisdpb
          page
          ifund    dcb:xlatestate
dcb:xlatestate equ dcb:profile+dpb:gpinit         translate state byte is 1st gp byte
          fin
xlatei:adm3
;   translate adm3 input found in (a), returning translated character in (a)
;   with carry clear; carry set will cause character to be lost
          ldab     #$7f                           assume swap for underscore key
          cmpa     #$5f                           swap for underscore ?
          beq      xlatei:adm3.b                  b/ yes, use (B) as translation
          ldab     #$5f                           assume swap for DEL key
          cmpa     #$7f                           swap for DEL key ?
          bne      xlatei:adm3.done               b/ no
xlatei:adm3.b ; use (B) as translation
          tba
xlatei:adm3.done
          okrts
          page

specialoutput:adm3posn
          ldaa     #ascii:esc
          jsr      sdos+sdos:vttlstore
          ldaa     #'=                           set up to do a position fn
          jsr      sdos+sdos:vttlstore
          tsx
          ldaa     2,x
          adda     #$20
          ldx      dcbpointer
          jsr      sdos+sdos:vttlstore
          tsx
          ldaa     3,x
          adda     #$20
          ldx      dcbpointer
          jsr      sdos+sdos:vttlstore
          okrts

specialoutput:adm3clear
          ldaa     #$1a                          performs a clear screen fn
          jsr      sdos+sdos:vttlstore
          okrts
          fin      profile.adm3
          ifund    profile.tvi912c
          else
          page     tvi912c profile and support code
profileloc.tvi912c set *
profilenum.tvi912c   equ 7

thisdpb   set      *
          fcb      profilenum.tvi912c             profile number
          fdb      profilenam.tvi912c             profile name
          fcb      dvtyp.console
          fdb      nextdpb                        next profile
          fcb      80                             default width
          fcb      24                             default depth
          fcb      12                             flags
          fdb      6*tickspersecond+ntimeoutblocks
          okrts                                   perform input translation
          if       m6800!m6801
          nop
          fin

        okrts                                     set output coloring
        if       m6800!m6801
          nop
        fin

        okrts                                     set background coloring
        if       m6800!m6801
          nop
        fin

        jmp     specialoutput:tvi912cclear
        jmp     sdos+sdos:vtnewlinecrlf
        jmp     specialoutput:tvi912ceeol
        jmp     specialoutput:tvi912cposn

*        fcb       0,0,0,0,0,0,0,0               gpinit data

profilenam.tvi912c   fcb               7
        fcc /TVI912c/

nextdpb   set      thisdpb

          page

specialoutput:tvi912cposn
          ldaa     #ascii:esc
          jsr      sdos+sdos:vttlstore
          ldaa     #'=                           set up to do a position fn
          jsr      sdos+sdos:vttlstore
          tsx
          ldaa     2,x
          adda     #$20
          ldx      dcbpointer
          jsr      sdos+sdos:vttlstore
          tsx
          ldaa     3,x
          adda     #$20
          ldx      dcbpointer
          jsr      sdos+sdos:vttlstore
          okrts

specialoutput:tvi912cclear
          ldaa     #$1a                          performs a clear screen fn
          jsr      sdos+sdos:vttlstore
          okrts

specialoutput:tvi912ceeol
          ldaa     #$1b
          jsr      sdos+sdos:vttlstore
          ldaa     #'T
          jsr      sdos+sdos:vttlstore
          okrts
          page
          fin      profile.tvi912c
          ifund    profile.soroc120
          else
          page     soroc120 profile and support code

profileloc.soroc120 set *
profilenum.soroc120   equ 4

thisdpb   set      *
          fcb      profilenum.soroc120            profile number
          fdb      profilenam.soroc120            profile name
          fcb      dvtyp.console
          fdb      nextdpb                        next profile
          fcb      80                             default width
          fcb      24                             default depth
          fcb      12                             flags
          fdb      6*tickspersecond+ntimeoutblocks
          okrts                                   perform input translation
          if       m6800!m6801
          nop
          fin

        okrts                                     set output coloring
        if       m6800!m6801
          nop
        fin

        okrts                                     set background coloring
        if       m6800!m6801
          nop
        fin

         jmp     specialoutput:soroc120clear
        jmp     sdos+sdos:vtnewlinecrlf
        jmp     specialoutput:soroc120eeol
        jmp     specialoutput:soroc120posn

 *       fcb       0,0,0,0,0,0,0,0               gpinit data

nextdpb   set      thisdpb

profilenam.Soroc120   fcb              8
        fcc /Soroc120/

          page

specialoutput:soroc120posn
          ldaa     #ascii:esc
          jsr      sdos+sdos:vttlstore
          ldaa     #'=                           set up to do a position fn
          jsr      sdos+sdos:vttlstore
          tsx
          ldaa     2,x
          adda     #$20
          ldx      dcbpointer
          jsr      sdos+sdos:vttlstore
          tsx
          ldaa     3,x
          adda     #$20
          ldx      dcbpointer
          jsr      sdos+sdos:vttlstore
          okrts

specialoutput:soroc120clear
          ldaa     #$1b                          performs a clear screen fn
          jsr      sdos+sdos:vttlstore
          ldaa     #'*
          jsr      sdos+sdos:vttlstore
          clra
          jsr      sdos+sdos:vttlstore
          clra
          jsr      sdos+sdos:vttlstore
          okrts

specialoutput:soroc120eeol
          ldaa     #$1b                          erase to end of line
          jsr      sdos+sdos:vttlstore
          ldaa     #'T
          jsr      sdos+sdos:vttlstore
          okrts
          page
          fin      profile.soroc120
          ifund    profile.h19
          else
          page     h19 profile and support code
profileloc.h19 set *
profilenum.h19   equ 5

thisdpb   set      *
          fcb      profilenum.h19                 profile number
          fdb      profilenam.h19                 profile name
          fcb      dvtyp.console
          fdb      nextdpb                        next profile
          fcb      80                             default width
          fcb      24                             default depth
          fcb      4                              flags
          fdb      6*tickspersecond+ntimeoutblocks
          jmp      xlatei:h19                     perform input translation

          jmp      coloring:h19                   set output coloring

          okrts                                     set background coloring
        if       m6800!m6801
          nop
        fin

  
        jmp     specialoutput:h19clear
        jmp     sdos+sdos:vtnewlinecrlf
        jmp     specialoutput:h19eeol
        jmp     specialoutput:h19posn

        fcb       0               gpinit data

nextdpb   set      thisdpb

profilenam.h19   fcb    3
        fcc /H19/

          page
          ifund    dcb:xlatestate
dcb:xlatestate equ dcb:profile+dpb:gpinit         translate state byte is 1st gp byte
          fin
xlatei:h19
;   translate h19 input found in (a), returning translated character in (a)
;   with carry clear; carry set will cause character to be lost
          tst      dcb:xlatestate,x
          bne      xlatei:h19.escape
          cmpa     #ascii:esc
          bne      xlatei:h19.ok
          inc      dcb:xlatestate,x
          errorrts

xlatei:h19.b ; use (B) as translation of character
          tba
xlatei:h19.ok ; (A) is tranlated character
          okrts

xlatei:h19.escape
;   if character following <ESC> is not A, B, C, D, J, N, or Q,
;   then bitch and revert to the standard state
          clr      dcb:xlatestate,x
          ldab     #ascii:vt
          cmpa     #'A                           cursor up?
          beq      xlatei:h19.b
          ldab     #ascii:lf
          cmpa     #'B                           cursor down?
          beq      xlatei:h19.b
          ldab     #ascii:ff
          cmpa     #'C                           cursor right?
          beq      xlatei:h19.b
          ldab     #ascii:bs
          cmpa     #'D                           cursor left?
          beq      xlatei:h19.b
          ldab     #ascii:enq
          cmpa     #'J                           ^E?
          beq      xlatei:h19.b
          ldab     #ascii:nak
          cmpa     #'N                           ^U?
          beq      xlatei:h19.b
          ldab     #ascii:esc
          cmpa     #'Q                           <ESC>?
          beq      xlatei:h19.b
xlatei:h1932
          inc      dcb:beepcount,x
          errorrts                               ignore character
          page

specialoutput:h19posn
          ldaa     #ascii:esc
          jsr      sdos+sdos:vttlstore
          ldaa     #'Y                           set up to do a position fn
          jsr      sdos+sdos:vttlstore
          tsx
          ldaa     2,x
          adda     #$20
          ldx      dcbpointer
          jsr      sdos+sdos:vttlstore
          tsx
          ldaa     3,x
          adda     #$20
          ldx      dcbpointer
          jsr      sdos+sdos:vttlstore
          okrts

specialoutput:h19clear
          ldaa     #ascii:esc
          jsr      sdos+sdos:vttlstore
          ldaa     #'E                           performs a clear screen fn
          jsr      sdos+sdos:vttlstore
          okrts

specialoutput:h19eeol
          ldaa     #ascii:esc
          jsr      sdos+sdos:vttlstore
          ldaa     #'K                           performs a eeol fn
          jsr      sdos+sdos:vttlstore
          okrts
          page
coloring:h19
          bita     #%00001000                     reverse video desired ?
          bne      coloring:h19reversevideo       b/ yes
          lda      #ascii:esc                     send "normal video" command
          jsr      sdos+sdos:vttlstore
          lda      #'q
          jmp      sdos+sdos:vttlstore

coloring:h19reversevideo
          lda      #ascii:esc                     send "reverse video" request
          jsr      sdos+sdos:vttlstore
          lda      #'p
          jmp      sdos+sdos:vttlstore
          fin      profile.h19
          ifund    profile.exorterm155
          else
          page     Exorterm 155 profile and support code
profileloc.exorterm155 set *
profilenum.exorterm155   equ 8

thisdpb   set      *
          fcb      profilenum.exorterm155         profile number
          fdb      profilenam.exorterm155         profile name
          fcb      dvtyp.console
          fdb      nextdpb                        next profile
          fcb      80                             default width
          fcb      24                             default depth
          fcb      12                             flags
          fdb      6*tickspersecond+ntimeoutblocks
          jmp      xlatei:exorterm155             perform input translation

        okrts                                     set output coloring
        if       m6800!m6801
          nop
        fin

        okrts                                     set background coloring
        if       m6800!m6801
          nop
        fin

         jmp     specialoutput:exorterm155clear
        jmp     specialoutput:exorterm155newline
        jmp     specialoutput:exorterm155eeol
        jmp     specialoutput:exorterm155posn

        fcb       0,0               gpinit data
nextdpb   set      thisdpb

profilenam.exorterm155   fcb           11
        fcc /ExorTerm155/

          page
          ifund    dcb:xlatestate
dcb:xlatestate equ dcb:profile+dpb:gpinit         translate state byte is 1st gp byte
          fin
xlatei:exorterm155
;   translate Exorterm155 input, returning translated character in (a)
;   with carry clear; carry set will cause character to be lost
;   Note: this routine assumes that Exorterm155 operated in "scroll" mode
          tst      dcb:xlatestate,x
          bne      xlatei:exorterm155.escape      b/ escape character last time
          cmpa     #ascii:esc
          bne      xlatei:exorterm155.other
          inc      dcb:xlatestate,x               remember escape seen
          errorrts

xlatei:exorterm155.other
          ldab     #$7f                           assume swap for underscore
          cmpa     #'_
          beq      xlatei:exorterm155.b
          ldab     #'_                            assume swap for DEL key
          cmpa     #$7f
          beq      xlatei:exorterm155.b
          tsta                                    otherwise, standard ascii ?
          bpl      xlatei:exorterm155.ok          b/ yes, leave it alone !
          ldab     #ascii:nak                     assume delete under cursor
          cmpa     #$d1                           character delete key ?
          beq      xlatei:exorterm155.b           b/ yes, use (B) as translation
          ldab     #ascii:can                     assume cancel line desired
          cmpa     #$d7                           delete line key ?
          bne      xlatei:exorterm155.badchar
xlatei:exorterm155.b ; use (B) as translated character
          tba
xlatei:exorterm155.ok
          okrts

xlatei:exorterm155.escape
;   if character following <ESC> is not <ESC>, bitch and revert to normal
          clr      dcb:xlatestate,x
          cmpa     #ascii:esc                     <ESC>
          beq      xlatei:exorterm155.useescape
xlatei:exorterm155.badchar ; input sequence is not legal
          inc      dcb:beepcount,x
          errorrts                                ignore character

xlatei:exorterm155.useescape
          ldaa     #ascii:esc
          okrts
          page
dcb:lastcolor       equ       dcb:xlatestate+1    holds last known color

specialoutput:exorterm155clear
          clr      dcb:lastcolor,x                record new standard color
          clr      dcb:lastcolor+1,x
          ldaa     #'7                            at each clear screen,...
          bsr      outputescsequence          set the screen size to 24 by 80
          ldaa     #'X                            performs a clear screen fn
          bra      outputescsequence

specialoutput:exorterm155eeol
          ldaa     #'U                            performs a eeol fn
          bra      outputescsequence
          page
specialoutput:exorterm155newline
          ldaa     #ascii:cr
          jsr      sdos+sdos:vttlstore
          ldaa     #ascii:lf                     put out <CR><LF>
          jsr      sdos+sdos:vttlstore
          ldd      dcb:lastcolor,x               then put out coloring info
          bned     coloring:exorterm155.doit
          okrts
          page
specialoutput:exorterm155posn
          ldaa     #'E                           set up to do a position fn
          bsr      outputescsequence
          tsx
          ldaa     2,x
          adda     #$20
          ldx      dcbpointer
          jsr      sdos+sdos:vttlstore
          tsx
          ldaa     3,x
          adda     #$20
          ldx      dcbpointer
          jsr      sdos+sdos:vttlstore

outputescsequence
          psha                                    save byte to send
          lda      #ascii:esc                     everything starts with "ESC"
          jsr      sdos+sdos:vttlstore
          bcs      outputescsequenceerr           b/ something is wrong...
          pula
          jmp      sdos+sdos:vttlstore
outputescsequenceerr
          ins
          jmp      sdos+sdos:errored

          page
coloring:exorterm155
          cmpd     dcb:lastcolor,x                same color as last time?
          beqd     coloring:exorterm155.okrts     yes, no work needed!
          std      dcb:lastcolor,x                save so ...:newline can see..
coloring:exorterm155.doit
          rola                                    generate "half-bright" code
          rola
          rola                                    c = 1 --> half-bright desired
          ldaa     #'e                            assume full-bright
          sbca     #0                             'd --> half, 'e --> full
          jsr      outputescsequence
          lda      dcb:lastcolor,x                get color code again
          asla                                    move blink to carry
          asla
          asla                                    C = 1 --> blink desired
          lda      #'a                            assume "blink disable" desired
          sbca     #0                             '` --> blink, 'a --> no blink
          jsr      outputescsequence
          asla                                    move Underscore bit to carry
          asla
          asla
          asla                                    C = 1 --> Underscore desired
          lda      #'g                            assume "no underscore" desired
          sbca     #0                             'f --> underscore, 'g --> plain
          jsr      outputescsequence
          lda      dcb:lastcolor,x                get color code again
          lsra                                    move reverse video bit to C
          lsra
          lsra
          lsra                                    C = 1 --> reverse video
          lda      #'c                            assume normal video
          sbca     #0                             'b --> reverse, 'c --> normal
          jsr      outputescsequence
          lda      #'D                            go right 1 to get past FAC
          jmp      outputescsequence

background:exorterm155
          lsra                                    move reverse video bit to C
          lsra
          lsra
          lsra                                    C = 1 --> reverse video
          lda      #'o                            assume normal video
          sbca     #0                             'n --> reverse, 'o --> normal
          jmp      outputescsequence
          fin      exorterm155
          page
ilgetdevstatusfromacia

;   receives control from the acia device access routine, returns either
;   the available character, with carry clear, or the error status, with
;   carry set.

;   the data or error status is returned in (a)

;   the status is defined as:

;         %00000001                 framing error (probably BREAK received)
;         %00000010                 overrun (data lost)
;         %00000100                 parity error

          bitb     #%01110000       check for parity, overrun, or framing errors
          bne      ilgetdevicestatusfromaciaerror
          okrts

ilgetdevicestatusfromaciaerror
          tba                       make a standard status byte
          lsra
          lsra
          lsra
          lsra
          anda     #%00000111
          errorrts
          fin      iodriverbody
          end
