HI all, I am trying to design an assembler in C based on some instruction sets. I want to read a assembly language file containing instructions. IN the hex file there is hex data, integer data and negative integer data. I need to convert that data into 8 bit hexadecimal data , out of which 6 bit represents hexadecimal data and the remaining 2 bit will be of opcode. For example ; ldc 0x1000 output: 00100000 (opcode of ldc is 00) ldc -3; output : fffffd00 (6 bit 2s complement of +3).
I am trying ltoa to convert the integer into hexadecimal, but its giving string as output so i am not able to append 0s . PLease suggest urgentl