r escape_parameter
;          first non digit char in  A
; -------------------------------------
get_number_from_esc_seq:
  lda #$00    ; assume $00
  sta escape_parameter
@next_digit:
  lda escape_buffer,x  ; get next char
  inx
  jsr test_if_digit   ; digit?
  bcc @done     ; no -> return
  sbc #$30    ; ascii to #
  pha         ; save digit
  ; old value * 10
  ; 10a = ( 4a + a ) * 2
  lda escape_parameter
  asl         
  asl         ; ( 4a
  clc
  adc escape_parameter    ; + a )
  a