]> git.sur5r.net Git - cc65/blobdiff - src/chrcvt/main.c
Do not use a separate byte for an END opcode, instead place the bit into the
[cc65] / src / chrcvt / main.c
index 4629ecfa121212b39f93d06ee2f8dca0fed22769..8b402655b756f70585e5e032d3f210402922754d 100644 (file)
@@ -238,7 +238,13 @@ static void ConvertChar (StrBuf* Data, const unsigned char* Buf)
 
             case 0x0000:
                 /* End */
-                SB_AppendChar (Data, 0x80);
+                if (SB_IsEmpty (Data)) {
+                    /* No ops. We need to add an empty one */
+                    SB_AppendChar (Data, 0x00);
+                    SB_AppendChar (Data, 0x00);
+                }
+                /* Add an end marker to the last op in the buffer */
+                SB_GetBuf (Data)[SB_GetLen (Data) - 2] |= 0x80;
                 return;
 
             case 0x0080: