signed 2's complement of a negative number for Integer = 3 and Fraction = 9
If your routine works correctly for converting positive numbers, you could just use it to convert a negative number by first adding the value of the sign bit (MSB) to the negative number (which must make it positive if it is not out of range), then convert the resulting positive number, and finally add the sign bit.
Example: convert the number $-0.7$ to Q3.9 format. The MSB has a value of $-2^2=-4$, so we first convert the number $-0.7+4=3.3$, which results in
011.010011010 ($= 3.30078125$)
Now you just add the sign bit and you obtain the representation of the original number:
111.010011010 ($=-0.69921875$)