riginal char
  cmp #$0d    ; CR?
  beq do_cr
 
  cmp #$08    ; BS?
  bne @not_bs
  ldy $d3     ; get col
  beq @bs_done   ; stop at left margin
  dey         ; dec column
  ldx $d6     ; get row
  jsr cursor_plot   ; set crsr
@bs_done:
  rts
@not_bs:
  cmp #$1b    ; esc?
  bne @not_escape
  lda #$0f    ; set esc mode
  sta escape_mode
  rts
@not_escape:
  cmp #$07    ; BEL?
  bne @not_bell  
  jsr beep
  rts
@not_bell:
  cmp #$0a    ; LF?
  beq do_line_feed
 
@not_lf:
  cmp #$09