Oops, H flag was overwriting the H register. Doh!