hmm... i think you could do this..
first of all if you encounter an A, it's gonna be a 10, and so on.
theres an alogorithm that basically says, take the remainder when you divide by the base you are converting to.
so if you have the number 4.
4%2 = 0
4/2 = 2, 2 goes down.
2%2 = 0
2/2 = 1, 1 goes down.
1%2 = 1
1/2 = 0, 0 goes down
0%2 = 0
so in turn you have 4 equaling 0100, which is correct.
this should work with hex numbers if indeed you convert the letters to numbers.
to make life easier, as you do this, push the modulus to a stack, and to print it out, just pop and print, pop and print, and it'll print it in the right way.
just another way to do it, the other ways are probably much better.