all dng file produced on my camera looks like this..any tip on how to fix it? 
Considering (if you hadn't modified the code completely) that I can't generate a DNG image and yours is corrupted, the problem might be in the buffer address definitions.
I was copying a lot by hand, so there's probably a mistake there somewhere. Like I said, it's still buggy. I'll recheck those later, there is something else I need to be doing over the weekend.