]> Untitled Git - emu8051.git/commitdiff
Add option to display bool hex character
authorHugo Villeneuve <hugo@hugovil.com>
Thu, 21 Nov 2013 04:55:41 +0000 (23:55 -0500)
committerHugo Villeneuve <hugo@hugovil.com>
Thu, 21 Nov 2013 05:33:25 +0000 (00:33 -0500)
src/hexfile.c

index ef828b84f49a0c8889ec491b55882c2e1a709532..57540bc4d9f91f4cef9199f40498870e5e3a6925 100644 (file)
 void
 int2asciihex(int val, char *str, int width)
 {
-       if (width == 2)
+       if (width == 1)
+               sprintf(str , "%.1X", (u_int8_t) val);
+       else if (width == 2)
                sprintf(str , "%.2X", (u_int8_t) val);
        else if (width == 4)
                sprintf(str , "%.4X", (u_int16_t) val);
+       else
+               sprintf(str , "Err");
 }
 
 /* Convert ASCII hex string to integer. */