Hello everyone!! I would very much appreciate some assistance from those of you who have worked with the Mplab-C compiler (names like Tjaart vd Walt spring to mind ;-) - hope I got the spelling right &-). I am working on a project in which I am using a PIC17C44 with the Mplab-C compiler. I am trying to write a string stored in ROM to a Hitachi based LCD. The important bits in the .lst file are shown below: Firstly the string: 0028 const char mystring[] = " A B C D E F G H\X00I"; 0028 20 41 20 42 20 43 20 44 002C 20 45 20 46 20 47 20 48 0030 00 49 00 00 The spaces in the string are there because the memory is 16 bits wide, the characters only 8. They are thus a workaround - without them only every second character is displayed by the following routine: void Write(char far *string) { char c; // define a char string = string & 0x7fff; // workaround - mplab-c wrongly sets the // highest bit c = *string; while (c |= 0) { SendChar(c); string++; c = *string; } } As I hinted in the subject of this message, I suspect that the while loop compiles incorrectly. The loop check compiles as follows: MOVLR 00h MOVFP 27,WREG ; get c BTFSC ALUSTA,2 ; zero? GOTO 0089h ; skip The code can be seen in context in the list file portion below. The problem is that the MOVFP instruction does not modify the flags, and the loop terminates only later once the zero (terminating) character has already been displayed!!! List file: void Write(char far *string) 0023 { Warning __longAC will save space if located < 0x0020 0070 BA00 MOVLR 00h 0071 0123 MOVWF 23 0072 4124 MOVPF FSR0,24 0027 char c; 0073 8F24 BCF 24,7 string = string & 0x7fff; 0074 6D23 MOVFP 23,TBLPTRL c = *string; 0075 6E24 MOVFP 24,TBLPTRH 0076 A80A TABLRD 0,0,0A 0077 A20A TLRD 1,0A 0078 0127 MOVWF 27 while (c |= 0) { 0079 BA00 MOVLR 00h //<<<<<<<< 007A 6A27 MOVFP 27,WREG //<<<<<<<< 007B 9A04 BTFSC ALUSTA,2 //<<<<<<<< 007C C089 GOTO 0089h //<<<<<<<< 007D SendChar(c); 007D BA00 MOVLR 00h 007E 6A27 MOVFP 27,WREG 007F E054 CALL 0054h 0080 BA00 MOVLR 00h string++; 0081 2523 INFSNZ 23 0082 1524 INCF 24 0083 6D23 MOVFP 23,TBLPTRL c = *string; 0084 6E24 MOVFP 24,TBLPTRH 0085 A80A TABLRD 0,0,0A 0086 A20A TLRD 1,0A 0087 0127 MOVWF 27 0088 C079 GOTO 0079h } 0089 0002 RETURN return; } A similar bug is documented for a do.. while loop, which is why I opted for a while(..) loop! Is there any workaround, or am I doing something stupid?? Any help would be very much appreciated... Roland Andrag