X-Git-Url: http://gitweb.hugovil.com/?a=blobdiff_plain;ds=sidebyside;f=src%2Fhexfile.c;h=57540bc4d9f91f4cef9199f40498870e5e3a6925;hb=b7b1c62985d33d453835903f523299114eecf7b7;hp=ef828b84f49a0c8889ec491b55882c2e1a709532;hpb=3e67c30ca5f1f959c06d1061556fa46c11163473;p=emu8051.git diff --git a/src/hexfile.c b/src/hexfile.c index ef828b8..57540bc 100644 --- a/src/hexfile.c +++ b/src/hexfile.c @@ -40,10 +40,14 @@ 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. */