Looks like cprintf modifies ptr3, so make sure to save it if you are calling that. There also may have been an issue with how the previous sector address was calculated, the one which does not account for carries seems to work.