Hi, when I use
printf("12345");
1234
prinf("12345\n")
Have you tried this on a real target? I think this is to do with the way the simulator handles the serial window - the '\n' completes a line, and causes it to be displayed immediately; without the '\n', it has only a partial line - maybe it then waits til it has 4 characters to display?
The simulator actually simulates the real timing of the device. If you simulate the single instruction (SBUF = 'a') you won't see the letter 'a' appear in the serial window at the next instruction. The reason is that it takes 10 baud time for the letter 'a' to get 'shifted' out the serial port. So, the 'a' will not appear until many instructions later. Any time you invoke printf, immediately following the printf return you will see the output minus the last character. The reason for this is simple. If you look at the way the putchar function (which is how printf outputs characters) works, you'll find the following logic:
while (!TI); TI=0; SBUF = char_to_send;