I want to encode a message using byte stuffing where every frame delimited by a flag byte 'F' at both ends and escape code equal to the character E. I am trying to encode the message 'DEEP-FRIED-FALAFELS' while the maximum window size is 10bytes.
What I am unsure about is, what happens when I try to escape a 'flag' or 'esc' but the maximum frame is reached. Do I continue onto the next frame as I have shown below or are am I meant to esc at the beginning of the next frame.
This is my supposed answer Frame1: FDEEEEP-EF, Frame2: FFRIEED-EF, Frame3: FFALAEFEEF, Frame4: FLSF