Remove superfluous bytes in program disassembly
authorHugo Villeneuve <hugo@hugovil.com>
Mon, 25 Nov 2013 01:39:30 +0000 (20:39 -0500)
committerHugo Villeneuve <hugo@hugovil.com>
Mon, 2 Dec 2013 01:53:34 +0000 (20:53 -0500)
Sometimes, B1 and B2 were showing old values from previous disassembly.
Now explicitly remove them for each disassembly line.

src/pgmwin.c

index 09a6e83..0e8961b 100644 (file)
@@ -273,9 +273,14 @@ pgmwin_refresh(void)
                        InstSize = cpu8051_get_instruction_size(OpCode);
 
                        /* Display instruction hex bytes. */
-                       for (k = 0, col_id = COL_B0; k < InstSize; k++, col_id++) {
-                               int2asciihex(memory_read8(PGM_MEM_ID, Address + k),
-                                            str, 2);
+                       for (k = 0, col_id = COL_B0; k < 3; k++, col_id++) {
+                               if (k < InstSize)
+                                       int2asciihex(memory_read8(PGM_MEM_ID,
+                                                                 Address + k),
+                                                    str, 2);
+                               else
+                                       str[0] = '\0';
+
                                gtk_list_store_set(store, &iter, col_id, str, -1);
                        }