I found two Bugs (but there are still at Minimum one open, which crashes the program):
------1st------
notescapeCode:
ld a,(isEscapeCode)
cp 0
jp z, not_in_escmode
ld hl, EscapeBuf
ld a, (EscapeCount)
inc a
ld e,a
ld d,0
add hl,de
ld (EscapeCount),a
; bugfix SOS
push af
ld a,b
ld (hl),a
pop af
cp 1
jp z, skip_check_esc_code ; we only want 0x1B,'[' ... for now
ld a,(hl)
------2nd------
recv_noblock:
push af
push bc
push de
push hl
;ld bc,2048 - to do empty entire receive buffer and use index
ld bc,1
call recv
cp $FF
;jp z, exit_close
jp z, exit_close_SP_Corr ; Bugfix SOS
cp 3
;jp z, exit_close
jp z, exit_close_SP_Corr ; Bugfix SOS
exit_close_SP_Corr ; NEW SOS
pop hl
pop hl
pop hl
pop hl
exit_close:
call disp_error
ld hl,cmdclose
call sendcmd